sublimelsp / LSP-vue

Vue support for Sublime's LSP plugin
MIT License
29 stars 3 forks source link

How to disable show autocomplete when enter space? #100

Closed pelemarse closed 3 years ago

pelemarse commented 3 years ago

Sublime Text 3.2.2, Build 3211 LSP-vue 1.1.5

https://user-images.githubusercontent.com/29234307/114116607-a7834080-98ed-11eb-871e-89edc280ae28.mov

rchl commented 3 years ago

The server decides that it wants the completions to be triggered on space.

I don't think you can change that in ST3 but it should be doable in ST4 (in a way).

pelemarse commented 3 years ago

The server decides that it wants the completions to be triggered on space.

I don't think you can change that in ST3 but it should be doable in ST4 (in a way).

I now testing ST4. This feature will appear in the LSP-vue package or in the Sublime Text editor settings itself?

rchl commented 3 years ago

In ST4 you can do this:

This will ensure that the auto-complete will only trigger on "." in the source code.

Now, this is not a complete solution because the original trigger characters that this server enables are:

"."
":"
"<"
"""
"'"
"/"
"@"
"*"
" "

So you might want to tweak that auto_complete_selector setting to enable it in more cases but that requires a bit of work as auto_complete_selector works based on scopes and not just plain characters as the server does. That's actually a good thing because it's pretty dumb to trigger completion based on character, regardless of the scope, but that means it requires more work to set up for a specific syntax.

rchl commented 3 years ago

I might be OK with creating a complete solution for this that uses auto_complete_selector but I'm not so sure about disabling that space trigger because I would want the completion to trigger when typing values in an object literal, for example:

{
  foo: |  // <here
}

or after typing await in await someFunction(), for example.

pelemarse commented 3 years ago

"auto_complete_selector": "punctuation.accessor"

Oh, that setting helped! Thank you very much! But it would be amazing if this functionality could be expanded in the future.:)

rwols commented 3 years ago

But it would be amazing if this functionality could be expanded in the future.:)

Expanded into what?

pelemarse commented 3 years ago

Expanded into what?

That autocomplete only calls on "." ":" "<" """ "'" "/" "@" "*". Without space " ".

Or trigger completion based on the scope.

rchl commented 3 years ago

We only have setting for setting triggers based on scope because the thinking here is that those are superior to character triggers.

That said, replicating space trigger with scopes could prove difficult or at least very verbose. I haven't tried but it could take some time to handle all cases.

Additionally, if we don't agree on whether completion should trigger or not in certain situations then we can't make a generic change that will satisfy everyone.

rchl commented 3 years ago

I don't think there is anything to act on here. Disabling space trigger in general might not be a change that people would like universally.

predragnikolic commented 3 years ago

There is a new Sublime text 4 setting in user preferences that disables showing autocomplete on space. That setting is "auto_complete_when_likely". You can set it to false.