Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
lukehutch opened this issue Jul 28, 2023 · 9 comments
Closed

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

lukehutch opened this issue Jul 28, 2023 · 9 comments
Labels
in editor Relates to code editing or language features in lsp/analysis server Something to be fixed in the Dart analysis server is bug relies on sdk changes Something that requires changes in the Dart/Flutter SDK to ship before it will become available
Milestone

Comments

@lukehutch
Copy link

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):
@DanTup
Copy link
Member

DanTup commented Jul 31, 2023

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!

@DanTup DanTup added the awaiting info Requires more information from the customer to progress label Jul 31, 2023
@DanTup
Copy link
Member

DanTup commented Jul 31, 2023

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

@DanTup DanTup added in editor Relates to code editing or language features in lsp/analysis server Something to be fixed in the Dart analysis server and removed awaiting info Requires more information from the customer to progress labels Jul 31, 2023
@DanTup DanTup added this to the v3.72.0 milestone Jul 31, 2023
@DanTup
Copy link
Member

DanTup commented Jul 31, 2023

copybara-service bot pushed a commit to dart-lang/sdk that referenced this issue Jul 31, 2023
…e name and generic type parameters

Fixes Dart-Code/Dart-Code#4668

Change-Id: Ibdb45b5c09ab8de0746239e351b5e581af4bb7df
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/317080
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
@lukehutch
Copy link
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?

@DanTup
Copy link
Member

DanTup commented Jul 31, 2023

@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!

@lukehutch
Copy link
Author

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

@lukehutch
Copy link
Author

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

@DanTup
Copy link
Member

DanTup commented Jul 31, 2023

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

@DanTup DanTup reopened this Jul 31, 2023
@DanTup
Copy link
Member

DanTup commented Aug 1, 2023

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

@DanTup DanTup closed this as completed Aug 1, 2023
@DanTup DanTup added the relies on sdk changes Something that requires changes in the Dart/Flutter SDK to ship before it will become available label Sep 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in editor Relates to code editing or language features in lsp/analysis server Something to be fixed in the Dart analysis server is bug relies on sdk changes Something that requires changes in the Dart/Flutter SDK to ship before it will become available
Projects
None yet
Development

No branches or pull requests

2 participants