-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Dart autocomplete should be giving precedence of variables that are inside the context, like variables and parameters #44273
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
Comments
Thanks for the feedback; can you include the version of the dart sdk you're using? |
Sorry I am away of the computer right now to check the version but it is the latest of the Flutter's stable branch. |
OK, if you could add the version when you're back at your computer that would be great. I'm assuming it'll be on or around Dart version |
I just confirmed it is |
I agree. |
Seems that the label on this issue is wrong, it should be 'area-completion' since it is happening outside Intellij too (take a look on other issues like #43657) . Could you please take a look @franklinyow ? |
@srawlins Should this go to "area-analyzer"? Thanks! |
@bwilkerson to confirm, but I am pretty sure this enhancement has been implemented. In minimal repros, I always get a local variable (like a parameter) at the top of the suggestions. |
No, it has not. As you can see, the local variable The completion request / response are:
|
For your minimal repro, in VS Code, I get StringLiteral as the top result. Since you reference the completion request/response, is VS Code probably re-ordering in my example, to the way we want? But if we re-order properly in analysis_server, maybe we will also get this good order in IntelliJ? |
VS Code re-ranks completions whenever there is a prefix typed (see microsoft/vscode#79516 (comment)). The theory is that because it filters the results client-side (using a fuzzy match), the rankings provided by the server might be based on without filtering, so might not be as good as it can compute taking into account the prefix (including caps for camel case, etc.).
In this case it may be what you want, though it can often go the other way |
AFAIK IntelliJ resorts completion suggestions according their This also represents some loss of information from DAS to IntelliJ. We tried to sort in DAS according to fuzzy matching score (and by relevance as a secondary component), cut, and return in this order, but because we don't change |
Sounds like we really need to include the fuzzy matching score in the relevance computation, pending further exploration of the value of relevance scores in general. I still hope to put together an experiment to measure the relative value of other relevance features compared to fuzzy matching. |
Raising to P2 as this is a significant productivity hit when trying to complete variables in the context. |
Using the distance from the completion location to the local variable was fixed 444ad4d. The distance to for formal parameters is not implemented yet. |
… non-locals. Bug: #44273 Change-Id: I1c8d488d46f23e3e781dcefd05f6788f43e62654 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/355821 Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Some refactoring before adding more nodes and tests. |
Added more tests in 692624b. |
Uh oh!
There was an error while loading. Please reload this page.
Hey guys! Thanks for creating such a wonderful language. However, the completion area could get a little more love.
It should be giving precedence of variables that are inside the context, like variables and parameters.
Check this pictures of me trying to get some auto-complete for the functions's parameter installation:
Really, this is a real pain and happens all the time. Varaibles with long names always fall on this problem and I have to fully type its name all the time.
If you guys need any kind of reports of logs just let me know!
The text was updated successfully, but these errors were encountered: