sublimelsp / LSP-volar

Vue support for Sublime's LSP plugin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The auto complete triggers are way too aggressive

FichteFoll opened this issue · comments

With volar, the AC popup opens way too frequently, most notably after inserting a comma. I noticed that the following gets added to my auto_complete_triggers setting:

{'characters': '!@#$%^&*()_+-=`~{}|[]:";\'<>?,./ ', 'selector': 'source - comment - string, meta.tag - punctuation.definition.tag.begin', 'server': 'LSP-volar'}

(https://github.com/johnsoncodehk/volar/blob/b3b30931080b3f377e8f33dbb4808fe216c7763a/packages/vue-language-server/src/registers/registerlanguageFeatures.ts#L59-L59)

I really only want to have auto completion after a period, so basically what the default settings already do via {"selector": "punctuation.accessor", "rhs_empty": true}.

I adopted the following section from the LSP-json plugin locally for me:

https://github.com/sublimelsp/LSP-json/blob/a65342f9908b0a759c148a574815d20811201b06/LSP-json.sublime-settings#L16-L21

It doesn't seem like VSCode triggers completions on comma, for example, even when the server returns same trigger characters.

@johnsoncodehk do you know why this wouldn't affect VSCode and why such choice of trigger characters?

All valid trigger character is collect from embedded language service plugin, but it cannot know at register language server features in advance, so vue language server config all characters and divert trigger character completion request itself.

If this causes problems, I can hardcode remove characters such as ',' for now.

If those trigger characters do nothing for VSCode (not sure what is its logic) and causes problems in other editors then removing would make sense IMO.

Please try @volar/vue-language-server v0.40.4.

Fix confirmed.

There still appears to be a rather large set of completion triggers (like ()[]-), but I wasn't able to get them to misbehave in contexts where I wouldn't expect completions to show.

You can config initializationOptions.languageFeatures.completion.ignoreTriggerCharacters to filter completion trigger characters that you don't wanted with v0.40.7.