Skip to content

Stop "tabstops" in completion snippets from highlighting all text typed at that location #1173

Closed

Description

@kerm1it

Select inserted text after Code Completion.
It won't appear Code Completion when inputting text in inserted text.

wechatimg3

Activity

  1. DanTup commented on Aug 23, 2018

    @DanTup
    Member

    I'm not sure exactly what's being asked for here, could you give more details?

  2. added
    awaiting infoRequires more information from the customer to progress
    on Aug 23, 2018
  3. kerm1it commented on Aug 24, 2018

    @kerm1it
    Author

    This is a gif to show issue:

    ca3dae8e-b331-4c07-8b41-964877854c81

  4. DanTup commented on Aug 24, 2018

    @DanTup
    Member

    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?).

  5. kerm1it commented on Aug 25, 2018

    @kerm1it
    Author

    it's selecting text it shouldn't

  6. DanTup commented on Aug 25, 2018

    @DanTup
    Member

    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?

  7. added
    in editorRelates to code editing or language features
    and removed
    awaiting infoRequires more information from the customer to progress
    on Aug 25, 2018
  8. added this to the v2.18.0 milestone on Aug 25, 2018
  9. kerm1it commented on Aug 25, 2018

    @kerm1it
    Author

    Yes, it's my pleasure, this is the log:

    Dart-Code-Log-2018-07-06 17-08.txt

  10. DanTup commented on Aug 27, 2018

    @DanTup
    Member

    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.

    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.

  11. added
    is enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.
    and removed on Aug 27, 2018
  12. 1 remaining item

  13. added this to the Backlog milestone on Aug 27, 2018
  14. 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
  15. modified the milestones: Backlog, v2.19.0 on Sep 4, 2018
  16. DanTup commented on Sep 4, 2018

    @DanTup
    Member

    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.

  17. modified the milestones: v2.19.0, v2.20.0 on Sep 19, 2018
  18. Skylled commented on Nov 2, 2018

    @Skylled
    Contributor

    I think this is still occurring on 2.20 Beta 2, albeit in fewer scenarios.
    GIF reproduction

  19. DanTup commented on Nov 2, 2018

    @DanTup
    Member

    @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.

  20. DanTup commented on Nov 27, 2019

    @DanTup
    Member

    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:

    1. A block of code is "highlighted" if it was being typed into a tabstop
    2. 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.

  21. brianegan commented on Feb 5, 2020

    @brianegan

    @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/

  22. DanTup commented on Feb 5, 2020

    @DanTup
    Member

    @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.

  23. DanTup commented on Feb 6, 2020

    @DanTup
    Member

    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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    in editorRelates to code editing or language featuresis enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions