Skip to content
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

Have "go to definition" jump to a class when used on a ConstructorExpression where the default constructor is missing #56241

Open
rrousselGit opened this issue Jul 15, 2024 · 2 comments
Labels
analyzer-server area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. P3 A lower priority bug or feature request type-enhancement A request for a change that isn't a bug

Comments

@rrousselGit
Copy link

rrousselGit commented Jul 15, 2024

(not sure if the issue should be here or in the Dart Code repo)

Consider the following code:

class Example {
  Example._();
}

Then used as:

Example(); // Error, no ._();

Notice the error. It is here on purpose in this example.
The problem is, in this snippet, it is impossible to use "go to definition" on that Example(). Since there's no Example() constructor, the analyzer doesn't provide any definition.

In the case of a missing default constructor, could we jump to the class definition instead?

@dart-github-bot
Copy link
Collaborator

Summary: "Go to definition" fails on a ConstructorExpression when the default constructor is missing, leading to no definition being provided by the analyzer. It proposes jumping to the class definition instead.

@dart-github-bot dart-github-bot added area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. triage-automation See https://github.com/dart-lang/ecosystem/tree/main/pkgs/sdk_triage_bot. type-enhancement A request for a change that isn't a bug labels Jul 15, 2024
@bwilkerson
Copy link
Member

Yes, this is the right issue tracker. Navigation support is provided by the language server, not the plugin.

And I agree, it would be reasonable for navigation to work that way.

I don't know whether we already have the information we need in order to make it work that way or whether it would be extra work to get it, but that's an implementation detail.

@srawlins srawlins added analyzer-server P3 A lower priority bug or feature request labels Jul 17, 2024
@lrhn lrhn removed the triage-automation See https://github.com/dart-lang/ecosystem/tree/main/pkgs/sdk_triage_bot. label Jul 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analyzer-server area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. P3 A lower priority bug or feature request type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

5 participants