You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Stop "tabstops" in completion snippets from highlighting all text typed at that location #1173
I'm afraid I'm still not sure what's being asked for (or is wrong?). Are you saying something is wrong (eg. it's selecting text it shouldn't), or asking for a change (eg. to select some text?).
Oh, I see what you mean now. This isn't a "selection" as when you type, it would replace that text if it was. I think this is the "placeholder" which lets you tab between values. I don't think it should ever start with a placeholder of 0 characters though, I'll do some digging.
Is it possible you could run the Dart: Capture Logs command, select the Analysis Server category and reproduce this, and then attach the log?
Thanks - I can reproduce this, but it seems like it's designed behaviour of VS Code :(
When we provide a completion when insertArgumentPlaceholders is enabled (the default), we give VS Code a completion like:
Container($1)$2
The $1's are tab stops. If you press <tab> after completing, you'll see the selection jumps between them. VS Code highlights the selected tab stop - this seems unwanted to me.
changed the title [-]Select inserted text after Code Completion[/-][+]Stop "tabstops" in completion snippets from highlighting all text typed at that location[/+]on Aug 27, 2018
@Skylled Indeed, it'll still happen for any completions that have arg placeholders (eg. required params), because that's the only way we can allow you to tab between them. If you disable the dart.insertArgumentPlaceholders setting it'll go away, but you won't get the placeholder values inserted. I don't believe there's any way to have the placeholders but not have this annoying behaviour.
I intend to completely remove insertArgumentPlaceholders when we can reliably trigger signature help automatically (this needs SDK work I haven't gotten round to), though enabling commit characters also disables it (though the logic for why somewhat escapes me).
I'd encourage you to try dart.insertArgumentPlaceholders: false for a while and see how it feels and let me know. I'll be sure to tweak the release notes to make it clearer that this case still remains and the reasons before releasing.
A heads up - in an upcoming release I'm reverting part of the fix for this issue as part of trying to make completion more consistent (#1940) and work better for @required params (#2123).
There are two issues described above:
A block of code is "highlighted" if it was being typed into a tabstop
Completion does not work when in this "snippet mode"
The fix was to force the tabstop to be the last one, which meant you'd exit snippet-mode immediately. This works fine for invocations with only a single argument placeholder, but if there are multiple you still see stay in snippet-mode. It would also prevent you tabbing out to after the ) and having to use cursor keys (which is what #1940 describes).
The second issue appears to have been fixed by VS Code - code completion (at least in my testing) works fine inside this snippet mode. Therefore I think reverting the fix to resolve #1940 is the best option. You'll still see the highlighted snippets but I think that's really just cosmetic (besides the change in handling of the tab key).
For the next release, this new behaviour will be behind a preview flag (dart.previewNewCompletionPlaceholders and called out in the release notes), but it's likely (depending on feedback) to become default in the following release.
@brianegan I hadn't seen that - thanks for the ping! I've opened #2248 about this - my comment above suggests I couldn't repro this any more, but that video suggests it's occuring. I'll take a look and if there's no obvious fix I'll revert the default of that setting in the meantime.
I've pushed out v3.8.1 which should fix this issue (while still supporting the new placeholders) - for anyone having issues that may have disabled this, please update to v3.8.1 and re-enable and let me know if you still have issues. Thanks!
Activity
DanTup commentedon Aug 23, 2018
I'm not sure exactly what's being asked for here, could you give more details?
kerm1it commentedon Aug 24, 2018
This is a gif to show issue:
DanTup commentedon Aug 24, 2018
I'm afraid I'm still not sure what's being asked for (or is wrong?). Are you saying something is wrong (eg. it's selecting text it shouldn't), or asking for a change (eg. to select some text?).
kerm1it commentedon Aug 25, 2018
it's selecting text it shouldn't
DanTup commentedon Aug 25, 2018
Oh, I see what you mean now. This isn't a "selection" as when you type, it would replace that text if it was. I think this is the "placeholder" which lets you tab between values. I don't think it should ever start with a placeholder of 0 characters though, I'll do some digging.
Is it possible you could run the
Dart: Capture Logscommand, select theAnalysis Servercategory and reproduce this, and then attach the log?kerm1it commentedon Aug 25, 2018
Yes, it's my pleasure, this is the log:
Dart-Code-Log-2018-07-06 17-08.txt
DanTup commentedon Aug 27, 2018
Thanks - I can reproduce this, but it seems like it's designed behaviour of VS Code :(
When we provide a completion when
insertArgumentPlaceholdersis enabled (the default), we give VS Code a completion like:Container($1)$2The $1's are tab stops. If you press
<tab>after completing, you'll see the selection jumps between them. VS Code highlights the selected tab stop - this seems unwanted to me.I've opened
microsoft/vscode#57251(edit: this was a dupe of microsoft/vscode#43270) to see if they agree it could be handled better.1 remaining item
[-]Select inserted text after Code Completion[/-][+]Stop "tabstops" in completion snippets from highlighting all text typed at that location[/+]DanTup commentedon Sep 4, 2018
In the last 30 min, another two people have reported this. I think we need to change something for vNext even if it's not a perfect fix.
Skylled commentedon Nov 2, 2018
I think this is still occurring on 2.20 Beta 2, albeit in fewer scenarios.
GIF reproduction
DanTup commentedon Nov 2, 2018
@Skylled Indeed, it'll still happen for any completions that have arg placeholders (eg. required params), because that's the only way we can allow you to tab between them. If you disable the
dart.insertArgumentPlaceholderssetting it'll go away, but you won't get the placeholder values inserted. I don't believe there's any way to have the placeholders but not have this annoying behaviour.I intend to completely remove insertArgumentPlaceholders when we can reliably trigger signature help automatically (this needs SDK work I haven't gotten round to), though enabling commit characters also disables it (though the logic for why somewhat escapes me).
I'd encourage you to try
dart.insertArgumentPlaceholders: falsefor a while and see how it feels and let me know. I'll be sure to tweak the release notes to make it clearer that this case still remains and the reasons before releasing.DanTup commentedon Nov 27, 2019
A heads up - in an upcoming release I'm reverting part of the fix for this issue as part of trying to make completion more consistent (#1940) and work better for
@requiredparams (#2123).There are two issues described above:
The fix was to force the tabstop to be the last one, which meant you'd exit snippet-mode immediately. This works fine for invocations with only a single argument placeholder, but if there are multiple you still see stay in snippet-mode. It would also prevent you tabbing out to after the
)and having to use cursor keys (which is what #1940 describes).The second issue appears to have been fixed by VS Code - code completion (at least in my testing) works fine inside this snippet mode. Therefore I think reverting the fix to resolve #1940 is the best option. You'll still see the highlighted snippets but I think that's really just cosmetic (besides the change in handling of the tab key).
For the next release, this new behaviour will be behind a preview flag (
dart.previewNewCompletionPlaceholdersand called out in the release notes), but it's likely (depending on feedback) to become default in the following release.brianegan commentedon Feb 5, 2020
@DanTup Hope all is Well :)
Sorry to dig up an old issue, but someone reported some more issues with this on Reddit, not sure if ya saw and wanted to point it out: https://www.reddit.com/r/FlutterDev/comments/ez5yog/ive_been_having_trouble_with_vscode_recently_can/
DanTup commentedon Feb 5, 2020
@brianegan I hadn't seen that - thanks for the ping! I've opened #2248 about this - my comment above suggests I couldn't repro this any more, but that video suggests it's occuring. I'll take a look and if there's no obvious fix I'll revert the default of that setting in the meantime.
DanTup commentedon Feb 6, 2020
I've pushed out v3.8.1 which should fix this issue (while still supporting the new placeholders) - for anyone having issues that may have disabled this, please update to v3.8.1 and re-enable and let me know if you still have issues. Thanks!