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

Code Completion should put compatible data types at the top of the list in parameters #43113

Open
petro-i opened this issue Aug 19, 2020 · 3 comments
Assignees
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-enhancement A request for a change that isn't a bug

Comments

@petro-i
Copy link

petro-i commented Aug 19, 2020

This tracker is for issues related to:
Analysis server version: 1.28.0
Dart SDK: 2.10.0-11.0.dev (dev) (Tue Aug 11 02:21:48 2020 -0700) on "windows_x64"

image

There is no reason to show all possible options in the list above, the correct one is not even shown, the suggestion compatible by data type should come at the top of list. I don't know if there is any reason to keep all not compatible data types in the list (you could filter them in addition), but the compatible should be at the top and selected by default.

@devoncarew devoncarew added area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. analyzer-completion Issues with the analysis server's code completion feature labels Aug 19, 2020
@devoncarew
Copy link
Member

Thanks for the feedback!

I agree that we could improve the ordering here - generally, you'd want the most relevant items closest to the top.

There are a few reasons why you'd want to show non-compatible types in the list. One reason is that people don't just use completion to save characters, they also use it for discovery (what fields / methods does this object support?). The other is that the compatible type for the left hand side might be available off a field or method return type from the initial expression you're completing. In the example above, the class Colors isn't a valid type for the named param colors:, however something like Colors.white would be.

@srawlins srawlins added the P3 A lower priority bug or feature request label Nov 10, 2020
@morrica
Copy link

morrica commented Mar 17, 2021

@devoncarew

In the example above, the class Colors isn't a valid type for the named param colors:, however something like Colors.white would be.

If that is the case, then when I type 'C' show Colors.white and omit Colors!

I do a lot of Dart and Java dev in Intellij. I love the Dart language, but going back and forth between the two really shows how terrible Dart auto-completion is. No other word for it. Just terrible. Maybe worse than no auto-complete at all. In my opinion, this is the biggest issue with Dart right now.</rant>

<praise>Regardless of the above, thanks for all the work you guys put into making it better.

@scheglov
Copy link
Contributor

scheglov commented Mar 9, 2024

I also expected to see Color.xyz here.
But I don't get it, and I have no explanation why resolveWith that does not return Color at all, is the first.
image

Or maybe theme.xyz is there is ThemeData theme = Theme.of(context).

This is another issue that requires experimenting with relevances.

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-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

5 participants