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

Completion commits unwanted completions that don't matched typed prefixes #55450

Closed
DanTup opened this issue Jul 31, 2018 · 7 comments
Closed
Assignees
Labels
*duplicate Issue identified as a duplicate of another issue(s)

Comments

@DanTup
Copy link
Contributor

DanTup commented Jul 31, 2018

I was writing this code that calls sortBy in lodash. The second argument is a function/lambda and the completion opened when I started typing a variable name. I don't want to complete here because I'm typing a new variable name - however when I pressed , it automatically committed, and resulted in SSL_OP_NO_TLSv1_1 being inserted.

Sorry the gif is slow, happened when I converted to GIF!

completion

Here the characters I typed are matches, t1,. The comma is a commit character in TypeScript.

This happens quite a lot and is rather frustrating. I don't think it ever makes sense to honour the commit character on a completion if the proceeding text doesn't match (or at least, it should be optional). I have a similar issue in my Dart extension and tried to solve it by only setting completion characters when the proceeding text matches, however since VS Code doesn't re-call the completion provider on every key stroke (it filters "client-side") this doesn't work correctly.

I know I could turn probably turn this behaviour off entirely, but I think it's really useful in the right context. If I've typed sort and the top item is sortBy then pressing ( to complete is great. What's described above however, is not. I don't think this is fixable in the TypeScript, I think it needs support from VS Code.

@vscodebot
Copy link

vscodebot bot commented Jul 31, 2018

(Experimental duplicate detection)
Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:

@mjbvz
Copy link
Contributor

mjbvz commented Aug 24, 2018

Sounds like a duplicate of #54386. Should be fixed in insiders

@mjbvz mjbvz closed this as completed Aug 24, 2018
@mjbvz mjbvz added the *duplicate Issue identified as a duplicate of another issue(s) label Aug 24, 2018
@DanTup
Copy link
Contributor Author

DanTup commented Aug 24, 2018

Isn't that just supporting disabling commit characters? I want commit characters, just not where they don't make sense or are super-fuzzy 😕

@mjbvz
Copy link
Contributor

mjbvz commented Aug 24, 2018

TypeScript uses intellisense to enable / disable , as a commit character based on what is around the cursor. I believe you should be able to do the same for dart

@DanTup
Copy link
Contributor Author

DanTup commented Aug 24, 2018

It was actually TypeScript I was thinking about here (though I do want to improve it in Dart too!), I looked at the changeset against that related case (cbcafcc) and it seemed like it was just supporting being turned off based on a setting.

If you're handling this conditionally, where can I find the code? I was under the impression that we had very limited control over this (because the commit characters are provided to VS Code once, then it filters things on its own, with no option for us to affect whether a character commits during that?).

@mjbvz
Copy link
Contributor

mjbvz commented Aug 24, 2018

No you can't do it dynamically as you type. TS tells us if we are in a new identifier location (such as an parameter name) and we use this to disable commit characters: https://github.com/Microsoft/vscode/blob/cbcafcc28463156179321a4190c479c92189f43a/extensions/typescript-language-features/src/features/completions.ts#L321

@DanTup
Copy link
Contributor Author

DanTup commented Aug 24, 2018

Aha, that makes sense - I'll open an issue to see if we can get something similar back from Dart, thanks!

@vscodebot vscodebot bot locked and limited conversation to collaborators Oct 8, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*duplicate Issue identified as a duplicate of another issue(s)
Projects
None yet
Development

No branches or pull requests

3 participants