Skip to content

Find All References doesn't work with class declaration #4668

Closed

Description

@lukehutch

Describe the bug

Given this class

class ProfileItem<T> extends StatelessWidget {
  const ProfileItem({
    Key? key,
  }) : super(key: key);
}

(and assuming that the class is used throughout my project,) if I select ProfileItem on the first line and then right-click and choose "Find All References", nothing is found. If I select ProfileItem on the second line (in the constructor definition) and then right-click and choose "Find All References", dart-code is able to find numerous references to the class.

To Reproduce
As above.

Expected behavior

Any reference to ProfileItem should correctly find all references. The syntax highlighter does highlight both references when I click on one of them.

Please complete the following information:

  • Operating System and version: Linux
  • VS Code version: latest
  • Dart extension version: latest
  • Dart/Flutter SDK version: latest
  • Target device (if the issue relates to Flutter debugging):

Activity

  1. DanTup commented on Jul 31, 2023

    @DanTup
    Member

    I think this might be the same as #4619. Does it only occur if you put the cursor at the end of the name, or have selected the whole class name (such as by double-clicking)? If you right click in the name without selecting it, does it work?

    If so, we can close this as a dupe of #4619 and it'll be fixed by https://dart-review.googlesource.com/c/sdk/+/316223.

    Otherwise, can you capture a log when reproduce this, as I can only repro the issue above.

    Could you try capturing debugging logs while reproducing this?

    Thanks!

  2. added
    awaiting infoRequires more information from the customer to progress
    on Jul 31, 2023
  3. DanTup commented on Jul 31, 2023

    @DanTup
    Member

    Actually, I think that fix only does Definition, not references - this might be a similar issue in different code.

  4. added
    in editorRelates to code editing or language features
    in lsp/analysis serverSomething to be fixed in the Dart analysis server
    and removed
    awaiting infoRequires more information from the customer to progress
    on Jul 31, 2023
  5. added this to the v3.72.0 milestone on Jul 31, 2023
  6. DanTup commented on Jul 31, 2023

    @DanTup
    Member
  7. lukehutch commented on Jul 31, 2023

    @lukehutch
    Author

    @DanTup OK, so just so that I understand -- you are able to replicate this now, hence the fix? Do I need to follow the repro+logging steps you requested a few comments ago, or are you confident you found and fixed it?

  8. DanTup commented on Jul 31, 2023

    @DanTup
    Member

    @lukehutch if the only issue you can reproduce is when the text cursor is just before the < (and this includes if you double-click the name to select it - in which case VS Code passes the end of the selection, which is just before the <) and it works fine if the cursor is in other parts of the name, then I'm confident my fix above is good.

    If you see issues when the text cursor is in other parts of the name, then a log would be useful. Thanks!

  9. lukehutch commented on Jul 31, 2023

    @lukehutch
    Author

    @DanTup Yes, it looks like the issue is only when the cursor is right before <. I hadn't noticed this before. Thanks!

  10. lukehutch commented on Jul 31, 2023

    @lukehutch
    Author

    Sorry, not sure if I should have closed this before your patch was merged -- feel free to reopen if needed.

  11. DanTup commented on Jul 31, 2023

    @DanTup
    Member

    Cool, thanks for confirming. Yep, will keep this open as a reminder until it's merged. Thanks!

  12. reopened this on Jul 31, 2023
  13. DanTup commented on Aug 1, 2023

    @DanTup
    Member

    Actually, the fix had already been merged before this was closed 🙃 dart-lang/sdk@8abaa7b

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