dart-lang / sdk

The Dart SDK, including the VM, JS and Wasm compilers, analysis, core libraries, and more.
https://dart.dev
BSD 3-Clause "New" or "Revised" License
10.09k stars 1.56k forks source link

Auto complete shows too many suggestions on types that have custom extension methods/properties #56760

Open ManuelRauber opened 2 hours ago

ManuelRauber commented 2 hours ago

Steps to reproduce

  1. Open the project using Android Studio.
  2. Open lib/package-c/example-c.dart.
  3. Within the method just start typing c.hasContent and observe the auto complete suggestions: image

The auto complete shows too many completion suggestions. There should only be the last one. The other two suggestions are just files importing the extensions as well, but not (re-) exporting them. If you create more files importing the extensions the more suggestions you will get.

Expected result:

I expect only to see the correct import of the file that also exports the extensions.

Actual result:

I see suggestions of files that only import the extensions for their own usage.

Additional information

Here is a GitHub Repo with an example to test yourself.

Used versions

dart-github-bot commented 2 hours ago

Summary: The issue is that Dart's auto-complete suggests too many imports when using custom extension methods/properties. It suggests files that import the extensions but don't re-export them, leading to an excessive number of suggestions.