Code Completion not optimized behaviour: Code Completion gives the class constructor as 2nd, or 7th suggestion, instead of first. #48600
Labels
area-devexp
For issues related to the analysis
8000
server, IDE support, linter, `dart fix`, and diagnostic messages.
devexp-completion
Issues with the analysis server's code completion feature
P2
A bug or feature request we're likely to work on
type-enhancement
A request for a change that isn't a bug
*I have already read the related threads, so i will summarize and reference what is already said in those.
Context: I'm building a flutter mobile app, using Android Studio, last version. When you are writing code, and have in mind the functionalities you want to build. Stopping to write, to correct symbols, that stops your flow a lot, that is why this is relevant.
In the specific case of widgets, the Code Completion not desired behaviour is that gives more relevance to the widget name

Scaffold
than to the widget constructorScaffold()
. So the widget name appears first in Code Completion.clarification for those not familiar with the subject
If you look at the image, the first suggestion, the one with the blue circle with a C in the left
It is the widget name, if you select it you get this
Scaffold
so you must type by yourself()
to finish itthe 7th suggestion, the one with the orange circle in the left
It is the widget constructor, if you select it, you get this
Scaffold()
so you don't need type the restlots of () is lot of time
You can improve sorting by name the code completion, but still improvable:

The key question is:
How can you get from Code Completion the class constructor as first suggestion, not as 2nd, or 7th
After asking to the IDE team
1 The order in these code complete suggestions is not given by the IDE software (Android Studio), but it is given by the dart sdk software
Reference:
https://intellij-support.jetbrains.com/hc/en-us/community/posts/4682230867346-Android-Studio-how-to-optimize-Code-Completion-behaviour-How-can-you-get-from-Code-Completion-the-class-constructor-as-first-suggestion-not-as-2nd
"Unfortunately it's not something that is controlled by the Dart plugin. Code completion, highlighting, quick fixes and other code insight features are powered by the Dart Analysis Server, a tool from the Dart SDK. IDE only shows what server asks it to show. For the reference, issues specific to the Dart Analysis Server are tracked in https://github.com/dart-lang/sdk/issues. Please feel free to submit a ticket there"
1.2 But sometimes the IDE can ignore this order and remake the order.
microsoft/vscode#79516 (comment)
After reading the related threads:
2 The order is given by the relevance, that comes from the relevance tables.
These tables was made from code repositories samples some years ago.
So the key question goes to:
1 If the dart team sees this correct, class constructor is more relevant than class name
to change the tables
2 If does not
how can you change, customize those tables in order to
The text was updated successfully, but these errors were encountered: