Skip to content

Completion for @override doesn't work well at the end of a class #3182

Closed

Description

@timsneath

Describe the bug
DartCode is over-eager to offer class autocompletions to attributes. See the screenshot: here it should ideally be offering me @override as the completion, rather than trying to auto-import random classes from dart:io :)

To Reproduce
Create a class, attempt to add an override (e.g. toString())

Expected behavior
Either offer me autocomplete for available attributes, or don't offer me autocomplete. The proffered choices will always create a syntax error.

Screenshots
image

Versions (please complete the following information):

  • VS Code version: 1.54.1
  • Dart extension version: 3.20.1
  • Dart/Flutter SDK version: 2.0 stable

(preview LSP is on)

Activity

  1. DanTup commented on Mar 7, 2021

    @DanTup
    Member

    I think this is the same as dart-lang/sdk#32677 and/or dart-lang/sdk#42266. Given the code above, the parser doesn't create an annotation (annotations are normally attached to other nodes, but there isn't on here) so the completion doesn't have the right context and produces bad results.

    I think it will require some parser changes (perhaps to create a synthetic element to attach the annotation to) in order to fix.

  2. DanTup commented on Mar 8, 2021

    @DanTup
    Member

    Closing this as a dupe of dart-lang/sdk#42266. If I insert a method below, then the completion works as expected, so it's definitely restricted only to where there isn't a node for the annotation.

  3. changed the title [-]@override has conflicting autocomplete with LSP[/-] [+]Completion for @override doesn't work well at the end of a file/class[/+] on Mar 8, 2021
  4. DanTup commented on Aug 23, 2022

    @DanTup
    Member

    The issue I closed this as a dupe of (completing the method names) was fixed, but it didn't resolve this issue (completing an annotation itself at the end of the class).

  5. reopened this on Aug 23, 2022
  6. added this to the On Deck milestone on Aug 23, 2022
  7. added
    in editorRelates to code editing or language features
    in lsp/analysis serverSomething to be fixed in the Dart analysis server
    and removed on Aug 23, 2022
  8. changed the title [-]Completion for @override doesn't work well at the end of a file/class[/-] [+]Completion for @override doesn't work well at the end of a class[/+] on Aug 23, 2022
  9. modified the milestones: On Deck, v3.50.0 on Aug 24, 2022
  10. DanTup commented on Aug 24, 2022

    @DanTup
    Member
  11. added
    relies on sdk changesSomething that requires changes in the Dart/Flutter SDK to ship before it will become available
    on Sep 6, 2022
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 bugrelies on sdk changesSomething that requires changes in the Dart/Flutter SDK to ship before it will become available

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions