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

[analyzer] Different completion results for constructors with and without named imports #56225

Open
incendial opened this issue Jul 11, 2024 · 2 comments
Labels
analyzer-completion Issues with the analysis server's code completion feature 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-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@incendial
Copy link
Contributor

Hi, consider the following example:

class Test {
  const Test();

  const Test.named();
}

when I type the name of this class and add . - only the named constructor appears in the completion suggestions:
Screenshot 2024-07-11 at 19 19 03

but when the class is imported via named imports, the default constructor also appears in the completion suggestions:
Screenshot 2024-07-11 at 19 20 09

which is inconsistent (and does not look like the desired behavior)

Dart SDK version: 3.4.3 (stable) (Tue Jun 4 19:51:39 2024 +0000) on "macos_arm64"

@dart-github-bot
Copy link
Collaborator

Summary: The Dart analyzer provides inconsistent constructor completion suggestions depending on whether the class is imported with a named import. The default constructor is only suggested when using a named import, which is unexpected and potentially confusing for users.

@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-bug Incorrect behavior (everything from a crash to more subtle misbehavior) labels Jul 11, 2024
@bwilkerson bwilkerson added the analyzer-completion Issues with the analysis server's code completion feature label Jul 11, 2024
@bwilkerson
Copy link
Member

I guess the first question is: which behavior is better? It seems a bit odd to me to suggest new because it's not a coding style we want to encourage, but it is valid so others might have a different opinion.

@keertip keertip added the P3 A lower priority bug or feature request label Jul 11, 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-completion Issues with the analysis server's code completion feature 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-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

5 participants