Skip to content

Code completion incorrectly returns results in comments at end of file #3170

Closed

Description

@eseidel

To Reproduce

  1. Open a new foo.dart file.
  2. Start typing a comment "// This is a test."
  3. Notice how you end up with "// This is a test.abstract\n".

Expected behavior
I would have expected typing return after the period to result in just a new line, not "abstract\n" added.

The autocomplete is just a bit aggressive inside comments (especially with nothing typed after the period).

Screenshots
autocomplete_bug

Versions (please complete the following information):

flutter doctor -v
[√] Flutter (Channel dev, 1.27.0-8.0.pre, on Microsoft Windows [Version 10.0.19041.804],
locale en-US)
• Flutter version 1.27.0-8.0.pre at C:\Users\micro\flutter
• Framework revision b7d4806243 (8 days ago), 2021-02-19 09:22:45 -0800
• Engine revision 6993cb229b
• Dart version 2.13.0 (build 2.13.0-30.0.dev)

[√] VS Code (version 1.53.2)
• VS Code at C:\Users\micro\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.16.0

Activity

  1. added this to the v3.21.0 milestone on Feb 28, 2021
  2. added
    in editorRelates to code editing or language features
    in lsp/analysis serverSomething to be fixed in the Dart analysis server
    on Feb 28, 2021
  3. DanTup commented on Feb 28, 2021

    @DanTup
    Member

    Thanks! I can repro this - it seems to only happen when the comment is the last thing in the file. I suspect this check isn't working right in that case.

    It also seems to set the replacement range to the whole comment, so if you invoke completion without the . it ends up replacing the whole thing:

    Screenshot 2021-02-28 at 11 05 50

    Screenshot 2021-02-28 at 11 05 55

    I'll take a look, thanks!

  4. changed the title [-]DartCode (or the analyzer?) unnecessarily completes after periods in comments[/-] [+]Code completion incorrectly returns results in comments at end of file[/+] on Mar 2, 2021
  5. DanTup commented on Mar 2, 2021

    @DanTup
    Member

    Fixed by dart-lang/sdk@f03ec46. The fix is in the SDK, so will show up in a future SDK update (rather than a Dart-Code update). 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 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