Skip to content

Go to Implementations on a getter gives random-looking results #4531

Closed

Description

@jcollins-g

Describe the bug
Right click and show implementations on a specific getter, and the in-line dialog shows obviously implausible suggestions. The feature works most of the time so I'm not sure what set of conditions is causing this. IntelliJ's plugin seems to give good results here, so to start with, filing with the VSCode plugin.

To Reproduce
Steps to reproduce the behavior:

  1. git clone [email protected]:dart-lang/dartdoc.git
  2. cd dartdoc && git checkout e8c5de44294d61890ef28ca91e3ecf38e50c1c69
  3. Set up directory as a Dart project
  4. Open lib/src/model/model_object_builder.dart in VSCode
  5. Go to line 36 and right click on modelBuilder, select "Go to Implementations".

Expected behavior
Show only links to valid implementations.

Screenshots
Screenshot 2023-05-08 at 1 34 46 PM

Please complete the following information:

  • Operating System and version: macOS 13.13.1
  • VS Code version: 1.78.0 (Universal)
  • Dart extension version: 3.63.20230502
  • Dart/Flutter SDK version: 3.1.0-86.0.dev
  • Target device (if the issue relates to Flutter debugging): n/a

Activity

  1. DanTup commented on May 9, 2023

    @DanTup
    Member

    😬

    Thanks for the detailed steps, I can reproduce this - taking a look.

    (btw, I'm curious what "Set up directory as a Dart project" meant in your steps though - you shouldn't need to do anything special for VS Code to load the Dart extension?)

  2. added
    in editorRelates to code editing or language features
    in lsp/analysis serverSomething to be fixed in the Dart analysis server
    on May 9, 2023
  3. added this to the v3.66.0 milestone on May 9, 2023
  4. DanTup commented on May 9, 2023

    @DanTup
    Member
    1683650484067:Info:Found item at 1111::11 of /Users/danny/Dev/Google/dartdoc/lib/src/element_type.dart
    1683650484067:Info:Changed to member at 1759::12 of /Users/danny/Dev/Google/dartdoc/lib/src/model/model_object_builder.dart
    

    Looks like we get confused by implementations coming from mixins in other files. We find abstract class ElementType in element_type.dart and then see if it has an implementation of modelBuilder and find it from the ModelBuilder mixin, but we use the original filename with the new offset/length.

  5. jcollins-g commented on May 9, 2023

    @jcollins-g
    Author

    Thanks for the detailed steps, I can reproduce this - taking a look.
    (btw, I'm curious what "Set up directory as a Dart project" meant in your steps though - you shouldn't need to do anything special for VS Code to load the Dart extension?)

    That was intended to be handwaving around open the directory in a workspace and press all the right buttons to make Dart work. Looks like it was successful enough :-)

  6. DanTup commented on May 9, 2023

    @DanTup
    Member

    Got it, thanks!

    I've got a fix open at https://dart-review.googlesource.com/c/sdk/+/302400.

  7. DanTup commented on May 10, 2023

    @DanTup
    Member

    Fix landed in dart-lang/sdk@334ce04.

    (the fix is part of the SDK so will show up with an SDK update, not Dart-Code update)

  8. added
    relies on sdk changesSomething that requires changes in the Dart/Flutter SDK to ship before it will become available
    on Jun 1, 2023
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