Skip to content

CTRL + Click on alias defined multiple times results in weird output #56931

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
FMorschel opened this issue Oct 21, 2024 · 4 comments
Closed

CTRL + Click on alias defined multiple times results in weird output #56931

FMorschel opened this issue Oct 21, 2024 · 4 comments
Labels
devexp-ux legacy-area-analyzer Use area-devexp instead. P3 A lower priority bug or feature request type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@FMorschel
Copy link
Contributor

Repro:

  1. Empty file a.dart
  2. File b.dart with class Foo {} inside.
  3. Create a file main.dart with the following content:
import 'a.dart' as lib;
import 'b.dart' as lib;

void main() {
  lib.Foo();
}

Even though Foo comes from b.dart when you CTRL + Click lib. before it, it moves the cursor for line 1 (import 'a.dart' as lib;).

I'd expect it to show the second line (for b.dart) or if both imports have that element for it to show a peek window to see all imports and select which you want (or default to this if there is nothing after the prefix).

This is a bad behaviour specially when there are multiple imports between the two (or more) that have the alias and you can't see them.


CC: @DanTup

@dart-github-bot
Copy link
Collaborator

Summary: The issue is that when using CTRL + Click on an alias defined multiple times in different imports, the IDE incorrectly navigates to the first import instead of the correct one or providing a peek window to choose between them. This behavior is problematic when multiple imports exist between the relevant ones, making it difficult to locate the correct source.

@dart-github-bot dart-github-bot added area-intellij Tracking issues for the Dart IntelliJ plugin. triage-automation See https://github.com/dart-lang/ecosystem/tree/main/pkgs/sdk_triage_bot. type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) labels Oct 21, 2024
@lrhn lrhn removed the triage-automation See https://github.com/dart-lang/ecosystem/tree/main/pkgs/sdk_triage_bot. label Oct 21, 2024
@bwilkerson bwilkerson added legacy-area-analyzer Use area-devexp instead. and removed area-intellij Tracking issues for the Dart IntelliJ plugin. labels Oct 21, 2024
@FMorschel
Copy link
Contributor Author

As a reference, this came from a talk about #32735

@keertip keertip added devexp-ux P3 A lower priority bug or feature request labels Oct 22, 2024
@FMorschel
Copy link
Contributor Author

After some discussion on Discord, I feel that the best option here is to keep it consistent with the results for #32735 and always show all the imports with that prefix.

@FMorschel
Copy link
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
devexp-ux legacy-area-analyzer Use area-devexp instead. P3 A lower priority bug or feature request type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

5 participants