-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Auto complete on variable destruction can be improved #59854
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
@srawlins can you think of any other case where we can have variable destruction like this? Did I forget anything? |
I also thought about code like destructing records: var (: myVar) = record; |
Similar to #60118, lots of invalid things here: ({int value1, String myString}) func() => (value1: 0, myString: 'string');
void main() {
var (:^) = func();
} But I'd also argue that the following (without Edit: Also, adding |
Can someone point me to where are extra code added on completion (do you know @DanTup)? I've already fixed the comment above locally, just trying to get it all in one go, it was really simple. |
Do you mean things like the
|
No, sorry for not being more clear. My idea is that for: void f(({int myInt,} r) {
if (r case (:^) {}
} It would show |
Oh, I see. I think this is handled by the difference in @override
String get completion =>
data?.completion ?? '@override ${element.displayName}'; |
Thanks a lot! I'll take a look into that then. |
Sorry I missed your earlier question; great find, that we have poor completion here. Thanks for looking into it! There are a few cases like There's also the |
I'm looking into all of those! One thing I meant to ask is, do we have a specific test for "extra completion" text? Similar to testing out an assist result code. I know we have And over at |
This should fix only part of this issue https://dart-review.googlesource.com/c/sdk/+/417143. I'm splitting this because the second part is more complex so having its own CL sounded better. I'm still working on this second part. |
Here is the second CL https://dart-review.googlesource.com/c/sdk/+/417222.
I understood the problem I was facing. The suggestions were not being built using the |
Hey @DanTup, could you please take a look at https://dart-review.googlesource.com/c/sdk/+/417222? I've just tested running it from source, and this is the visual output: My idea was actually to keep the member name only and to fill Can you tell what I did wrong here? Thanks! |
@FMorschel hmm, on the surface the code looks reasonable, so I'd have to do some debugging. I wonder if we don't handle the difference between If you can repro in a test, you could try debugging the code that builds the insert text, which I would expect is around here:
|
Thanks! With your guidance, I found that if these suggestions were The label filling is actually done a bit after this line, but it is really close! |
Originally opened at Dart-Code/Dart-Code#5379.
Is your feature request related to a problem? Please describe.
When you have code like this:
When inside
List(^)
you get prompted by auto-complete for all proprieties the class has. But when you auto-complete, it simply fills the propriety name and not:var isEmpty
which is a valid syntax for getting that value (infor in
loops you also can do this but thevar
is then before the Type name). We already have the rename refactor for changing the variable name to a new one if we want to, but I feel like this would help more than harm most of the time.Describe the solution you'd like
For it to auto-complete with
:var
before the propriety name (if you know what lints are available maybe we can look at the ones that ask for thefinal
keyword or the type name) onif case
s and without thevar
keyword onfor in
loops.The text was updated successfully, but these errors were encountered: