-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Add commitCharacters to analysis server's CompletionSuggestion #32240
Comments
I'm not sure I'd like that. It means that if there is a matching completion then the user can't type those characters without selecting it, even if that's not what they intended to do. Also, deviating from the IDE's normal behavior can sometimes be disconcerting. |
This is how the IDEs I've used and other languages in Code work. Usually there is a setting to disable it (in VS they call it something like "low impact intellisense mode" and in VS Code you disable I've been getting annoyed by this but didn't really twig what it was until recently; imagine this: I always hit In VS Code there's specifically an API to allow for commit characters per completion item, as different characters make sense for different types of items. I don't mind handling this in Dart Code; though I might ask for you to review the mapping I make it so, to ensure it seems reasonable (you know the syntax and kinds much better than me!). |
Well, if it's a supported feature of VS Code, then it certainly won't bother users. And I agree that it would be better to let server tell you. That way the plugin doesn't need to be updated every time the language changes. |
@bwilkerson I had a go at implementing this in the plugin for now to see this working, however it triggers way too often and is somewhat unusable right now. For ex.: void myFunc(Object b, Object c) {}
myFunc(myFunc, myFunc); When typing a comma in the call (line 3), we want So, whether or not to automatically commit is based on the context/location we're typing and not only on the type of the completion item. In TypeScript, the request for completion includes some information like export interface CompletionInfo {
readonly isGlobalCompletion: boolean;
readonly isMemberCompletion: boolean;
readonly isNewIdentifierLocation: boolean;
readonly entries: ReadonlyArray<CompletionEntry>;
} enableCommitCharacters = !body.isNewIdentifierLocation; Could we do something similar here? Any opinions on what form it should take? |
This was for VS Code which is now using LSP. Commit characters are handled as part of LSP, although currently behind a flag ( |
I'm currently trying to add support to Code to have better commit characters on completion items to avoid users having to hit tab/enter to accept completion items.
For example:
Some examples:
^1
pressing.
orspace
should complete (since they're both reasonable things for the user to type on the end offield
).^2
pressing(
should complete.^3
pressing.
should complete.^4
pressing,
or)
should complete.while I can code this into my extension (and currently I'm trying - something like the below) it seems like the server would be the best place for this knowledge.
The text was updated successfully, but these errors were encountered: