Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow the provideCompletionItems method to exist with triggerCharacters parameters as optional instead of being mandatory. #211411

Closed
LuisCaceres opened this issue Apr 26, 2024 · 2 comments
Assignees
Labels
*question Issue represents a question, should be posted to StackOverflow (VS Code) suggest IntelliSense, Auto Complete

Comments

@LuisCaceres
Copy link

Allow the provideCompletionItems method to exist with triggerCharacters parameters as optional. In that case, alphanumerical characters are also triggers for code completion by default.

I'm not sure whether this is a bug or a feature. I'll treat it as a feature for now. Anyway, I'm currently using the provideCompletionItems method for a VS Code Extension which seems to require at least 1 non-alphanumerical character as a trigger. This is the triggerCharacters parameter of that same method. However, that doesn't align with how VS Code works out-of-the-box with code completions from IntelliSense. At least not in a JavaScript file. For example, as soon as you type the character "d" in a JavaScript file, out-of-the-box code completions are already suggested (for example, "debugger"). On the other hand, if I write my own VS Code Extension and I want my own code completions, it seems that I must specify a non-alphanumerical character as a trigger (for example, "/"). What I'd like to do is to allow completions without having to rely on a trigger character that isn't alphanumerical. For example, if I type the letter "a" within a single-line comment then my VS Code Extension can retrieve a list of identifiers in that file that start with the letter "a".

Thank you.

@RedCMD
Copy link
Contributor

RedCMD commented Apr 26, 2024

"wordPattern" under language-configuration.json is used for triggering intellisense

by default the standardTokenType; string, comment and regex disables auto triggers
this can be changed with editor.quickSuggestions

ctrl+space will always bring up intellisense (manual)

@jrieken
Copy link
Member

jrieken commented May 2, 2024

There is two features

  1. IntelliSense as you type aka quick suggestions which starts IntelliSense when typing at word ends (setting: editor.quickSuggestions)
  2. Trigger character which starts IntelliSense when typing other characters, like . (setting: editor.suggestOnTriggerCharacters)

Both features have their own settings and can be enabled/disabled individually. Therefore we do not allow trigger characters that are also "word ends", e.g the rules for quick suggest are strong than those for trigger characters.

@jrieken jrieken closed this as completed May 2, 2024
@jrieken jrieken added *question Issue represents a question, should be posted to StackOverflow (VS Code) suggest IntelliSense, Auto Complete labels May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
*question Issue represents a question, should be posted to StackOverflow (VS Code) suggest IntelliSense, Auto Complete
Projects
None yet
Development

No branches or pull requests

3 participants