sublimelsp / LSP-volar

Vue support for Sublime's LSP plugin
MIT License
84 stars 8 forks source link

The auto complete triggers are way too aggressive #114

Closed FichteFoll closed 2 years ago

FichteFoll commented 2 years ago

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

rchl commented 2 years ago

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?

johnsoncodehk commented 2 years ago

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.

rchl commented 2 years ago

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.

johnsoncodehk commented 2 years ago

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

rchl commented 2 years ago

Released in https://github.com/sublimelsp/LSP-volar/releases/tag/v1.1.0

FichteFoll commented 2 years ago

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.

johnsoncodehk commented 2 years ago

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