-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Add quick-fix to fix all of type across the whole file #32474
Comments
A |
Is this not implemented yet? There's certainly some support for it on the server side, but I don't know how far that support was taken. |
/cc'ing @jwren who knows about it from the IntelliJ perspective (Jaime is OOO currently however) |
Oh, nice - I found https://dart-review.googlesource.com/c/sdk/+/56220. And it works: However, it looks like each fix needs specific work (it's not just just a general "fix all of type in file") so I'm not sure whether it's complete and/or how many it's going to cover. |
Correct. Sometimes the changes introduced by a fix are not additive. Consider, for example, the "define a method" fix for an undefined method invocation. If the same method name is invoked multiple times in a file it's important that the method is only defined once. The simple lexical changes implemented by |
Good point - I guess in TypeScript there's probably some whitelist too then (I couldn't actually get it to give me a suggestion for creating a function now to test it - no idea why, I'm sure it used to support that!). |
Actually, this would bring tremendous benefits with relatively little work. Maybe prioritizing this, before adding new quick fixes. |
I recently raised #44258 which I guess is actually a dupe of that one. That one has a little more info about implementation (since it's now available in LSP, but not in the original protocol) so I'll close this one and keep that one open. |
One of the things I love about the TypeScript linting in VS Code is that I can fix all instances of the same problem in one go from the quickfix menu. Eg., if I enable a new lint and there are 50 violations in a file and I know they're all safe (eg. use double quotes instead of single), it's just one operation:
It'd be great to support the same for Dart (the TS one is actually really buggy, so maybe we can be better!).
@bwilkerson I could possibly make this work without analyzer changes, but it'd end up sending a lot of requests (basically take the diagnostic from the quick fix, find all instances of it in that file, then send requests for fixes for them all and apply them together) but API changes would make it more efficient (I guess this is a similar request to #32462 but for fixes instead of assists).
The text was updated successfully, but these errors were encountered: