Dart-Code: Keybinding code fixes don't work
It would be very useful to have “fix all” command for linter rules. For example I have now ~400 warnings in my project for prefer_single_quotes
. There is already a quick fix command “Convert to single quoted string” but it is too big task to fix all those issues one by one. I would like to fix all the warnings with a single command.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 2
- Comments: 21 (12 by maintainers)
Commits related to this issue
- Filter code actions before returning to VS Code See https://github.com/Dart-Code/Dart-Code/issues/2169. — committed to Dart-Code/Dart-Code by DanTup 4 years ago
- Change format of IDs for fixes and attach them to generated changes Having IDs to the change allows them to be key-bound in VS Code (see https://github.com/Dart-Code/Dart-Code/issues/2169). Changing... — committed to dart-lang/sdk by DanTup 4 years ago
- Add code actions to package.json for keybinding See https://github.com/Dart-Code/Dart-Code/issues/2169. — committed to Dart-Code/Dart-Code by DanTup 4 years ago
Thank you so much for the update. Thank you for being so approachable and your effort to support us. Cheers
Ok, I figured this out. Doing
toDoubleQuotedString
works, buttoStringleQuotedString
does not, and the reason is that one comes as an “assist” and the other as a “fix”, and the two code paths aren’t the same (only one sets the ID correctly).Working on a fix!
That’s very understandable, the line can be a bit blurry (for example some of the things you see in the quick-fix drop-down are synthetic and generated by the VS code extension). If in doubt, just raise things here - I’m happy to triage them and can sometimes provide additional context that would improve a bug report in the SDK/Flutter repos.
Thanks!