Sublime Forum

[BUG] Autocompletion doesn't open the popup

#1

Start a new file and enter:

vDocNumber vComNameDOC vGcoNameDOC

The IMHO right behavior:

type vn
tab -> vDocNumber
ctrl+space -> open the autocompletion popup

Now the wrong one:

type vdoc
tab -> vDocNumber
ctrl+space -> vComNameDOC

There’s no way to autocomplete with vGcoNameDOC

And same strange behavior without the tab key:

type vdoc
ctrl+space -> vComNameDOC

startup, version: 2060 windows x64 channel: dev

0 Likes

How to autocomplete inside a word?
#2

Ctrl+Space will insert the best completion, rather than showing a list, if the first completion ranks significantly better than the next best completion. This is important, otherwise ctrl+space can end up showing a list of completions when there’s only a single sane choice.

I don’t believe it’s clear that a list should be shown in this example for the completion ‘vdoc’.

0 Likes

#3

Your explication make sense to me, but I don’t think that the current behavior match exactly what you expect.

It look like, at least when tab_completion is active, ctrl+space always trigger the second best completion rank, whatever you press tab before or not.
I suppose that this behavior only make sense if the last command was an “insert_best_completion”, so in this example the correct completion is “vDocNumber”, isn’t it ?

type vdoc
ctrl+space -> vComNameDOC

And the second glitch is that in my list, for “vdoc” the best completion is clearly “vDocNumber”, but the two others must be almost at the same level.
So I think in this case the popup must be shown.

type vdoc
tab -> vDocNumber
ctrl+space -> vComNameDOC

It look like ST make the decision to not show the popup based not on the remaining items in the list, but on the complete items list.
In this context ST must look at the remaining items (vComNameDOC, vGcoNameDOC) and because the rank is almost the same show the popup.

Hope I was clear.

Thanks for your time.

0 Likes

#4

In a buffer containing only those three lines, typing vdoc on a new line and pressing ctrl+space will show a popup for me. Which entry in the list is highlighted depends on the selection history, e.g., change the highlighted entry, press enter, and repeat the experiment - the initial highlight will now be different.

vDocNumber ranks significantly higher than the others for vdoc (suppressing the popup), because vdoc is a prefix of vDocNumber, but not of the other entries. Prefix matches are ranked highly, in part because that’s what users expect from non-fuzzy matching auto completion systems.

0 Likes

#5

Ah this is the problem, for me in the same context typing vdoc and pressing ctrl+space replace “vdoc” by “vComNameDOC” without showing the popup, whatever the value of tab_completion.

Any idea of why this difference in the behavior between you and me ?
There’s nothing special in my key bindings file.

Edit:
I try to delete these lines from “auto_complete” block of my Session.sublime_session:

"vdoc",
"vComNameDOC"
],[/code]
and now the behavior is different:
[code]type vdoc
ctrl+space or tab -> vDocNumber
ctrl+space -> nothing happen

So it’s better but no popup for me ???

0 Likes

#6

Sorry, I was getting confused with a testing build there - ctrl+space on “vdoc” completes it to “vDocNumber” for me, without showing a popup, because the completion for vDocNumber ranks much higher than the others, because of the prefix match.

0 Likes

#7

Thanks for your answer and sorry if I seem low-minded, but I still believe that the current behavior is not correct when you use ctrl+space to **correct **the last completion:
this is the current behavior:

type vdoc
tab (or ctrl+space) -> vDocName
ctrl+space -> nothing

And this is what I expect:

type vdoc
tab (or ctrl+space) -> vDocName
ctrl+space -> open the autocompletion list

If the default (higher) completion doesn’t return the right thing, I like to choose another item even if the default one as a much greater rank than the others.
I think that the best thing to do when you **correct **an already completed word is to open the popup list.
You could try with “vname” in this example to show what I expect.

0 Likes

#8

I also have trouble with the insert best completion. But I find out on the current build of Sublime Text as 3114, you can change the default auto-complete key bind to stop insertion best completions.

Just set this on your user key map file:

{ "keys": ["ctrl+space"], "command": "auto_complete", "args": {"disable_auto_insert": true, "next_completion_if_showing": false} },
0 Likes