Skip to content

Autocomplete for symbols from package:charcode ends up with duplicated dollar ($) characters #3943

Closed

Description

@jamesderlin

Describe the bug
When I attempt to autocomplete the generated symbols from package:charcode that start with a $ character, the autocompleted symbol ends up with $$.

To Reproduce

  1. Add import 'package:charcode/charcode.dart'; to some .dart file.
  2. Start typing $ba. The autocomplete list appears, listing $backquote, $backslash, ...
  3. Press Tab.

$ba gets autocompleted to $$backquote.

Expected behavior
$ba should have been autocompleted to $backquote.

Other notes
Strangely, if I define my own variable (e.g. var $foo = 'bar';), then that seems to autocomplete fine. I'm not sure why the symbols from package:charcode are autocompleting differently.

Versions

  • Operating System and version: Ubuntu 20.04.4 LTS (x64)
  • VS Code version: 1.66.2
  • Dart extension version: 3.38.2
  • Dart/Flutter SDK version: Dart 2.16.2

Activity

  1. DanTup commented on Apr 27, 2022

    @DanTup
    Member

    Strangely, if I define my own variable (e.g. var $foo = 'bar';), then that seems to autocomplete fine. I'm not sure why the symbols from package:charcode are autocompleting differently.

    It looks like for "external" items, we don't provide the textEdit up-front (computing it lazily instead):

    Screenshot 2022-04-27 at 10 33 19

    This is not valid, so I'm not sure how we ended up doing this. What's happening here is that VS Code is guessing which range to replace (since the lazy-computed one from the server is too late), and it doesn't know that $ is a valid part of identifier.

  2. added
    in editorRelates to code editing or language features
    in lsp/analysis serverSomething to be fixed in the Dart analysis server
    on Apr 27, 2022
  3. added this to the v3.40.0 milestone on Apr 27, 2022
  4. DanTup commented on Apr 27, 2022

    @DanTup
    Member

    Fixing this by adding the edits to every completion item bloats the payload quite significantly, so I'm going to bump fixing this until next month, when LSP 3.17 should have been released and we can use CompletionList.itemDefaults to set the range.

  5. modified the milestones: v3.40.0, v3.42.0 on Apr 27, 2022
  6. modified the milestones: v3.42.0, v3.44.0 on May 25, 2022
  7. DanTup commented on Jun 20, 2022

    @DanTup
    Member
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 featuresin lsp/analysis serverSomething to be fixed in the Dart analysis serveris bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions