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

[CP] Suggest static fields/getters, setState(). #49239

Closed
scheglov opened this issue Jun 13, 2022 · 9 comments
Closed

[CP] Suggest static fields/getters, setState(). #49239

scheglov opened this issue Jun 13, 2022 · 9 comments
Assignees
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. cherry-pick-approved Label for approved cherrypick request P2 A bug or feature request we're likely to work on

Comments

@scheglov
Copy link
Contributor

scheglov commented Jun 13, 2022

Commit(s) to merge

https://dart-review.googlesource.com/c/sdk/+/248080

Target

stable

Issue Description

This includes fixes for completions:

  1. Suggest static fields when the context type matches.
  2. A fix for the context type.
  3. A fix for setState completion.

What is the fix

These fixes were done in the master, but we need them in stable as well.

Why cherry-pick

Static field suggestions are useful for suggesting Colors for example in Flutter code.
And setState() is also used very often.

@bwilkerson @jacob314

Risk

low

Issue link(s)

#49233
#49054 (comment)
#49054

Extra Info

No response

@scheglov scheglov added the cherry-pick-review Issue that need cherry pick triage to approve label Jun 13, 2022
@devoncarew devoncarew added the area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. label Jun 15, 2022
@devoncarew
Copy link
Member

@itsjustkevin - pinging just to make sure this is reviewed by the dart scrum

@pq pq added the P2 A bug or feature request we're likely to work on label Jun 15, 2022
@itsjustkevin
Copy link
Contributor

itsjustkevin commented Jun 17, 2022

@vsmenon @athomas @devoncarew what are your thoughts on merging this CP into stable?

@vsmenon
Copy link
Member

vsmenon commented Jun 17, 2022

This is a fairly big CL. Do we want to give this more bake time? Do we have feedback that it works from users?

@sigmundch
Copy link
Member

At a first glance the description may give the impression here that this is new feature work, but it appears this is more to address an important regression (if I understand correctly the related bugs) - @scheglov can you confirm and share some details to clarify how bad the regression is?

@scheglov
Copy link
Contributor Author

Yes, this CP contains fixes for regressions.

The biggest one is absence of suggesting static fields, so you cannot type color: blue^ and get Colors.blue suggestion and others. The same is for alignment. With the fix it works again:
image

Another unpleasant regression that was fixed is setState suggestion, which we special-cased in suggestions builder (long time ago), but did not support specially in the new protocol (when the regression happened). So, the users don't get setState at all. This is quite bad, it must be an often used invocation.

The fix for the context type of a named argument is necessary for the static fields suggestions to work, and is very small.

The last fix is suggestions in URIs, so that when there are many URIs (many packages available in pubspec.yaml), we filter them by name correctly. I think this one is less important, but it is not big as well.

All these fixes are already done in the master. As for backing, I'm not sure that this helps. These regressions were present for a couple of months, and nobody noticed or reported them until after stable release. So, maybe nobody uses anything other than stable, or nobody cares.

@khanahsan
Copy link

Code suggestion for async/dispose/setState no longer works in Flutter 3.0.2 #106724

i'm still face this issue in Android Studio i use dart 2.17.3 version

@xshiwei
Copy link

xshiwei commented Jul 4, 2022

Also invalid in version 3.0.4

@vsmenon
Copy link
Member

vsmenon commented Jul 6, 2022

lgtm

@mraleph mraleph removed the cherry-pick-review Issue that need cherry pick triage to approve label Jul 6, 2022
@whesse
Copy link
Contributor

whesse commented Jul 13, 2022

This was picked into stable 2.17.6

@whesse whesse closed this as completed Jul 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. cherry-pick-approved Label for approved cherrypick request P2 A bug or feature request we're likely to work on
Projects
None yet
Development

No branches or pull requests