dart_custom_lint
dart_custom_lint copied to clipboard
Support for Quick Assists
Hello,
At the moment dart_custom_lint is capable of supporting custom quick fixes, and that's great. Do you think we can do the same thing to support quick assists too?
Sure.
I tried implementing it: I added a handler for assists (very similar to the existing getFixes) and modified packages/custom_lint/example project by copying the same resolution written for getLints method into the new one but for some reason I can't figure out at the moment the quick fix option doesn't show up on VS Code.
This is the ResponseResult json object sent to the server:
[example_lint] 2022-07-17T09:45:16.638095 {assists: [{priority: 100, change: {message: Replace to Hello, edits: [{file: d:\Work\flutter_extensions\dart_custom_lint\packages\custom_lint\example\lib\main.dart, fileStamp: 1658043916605, edits: [{offset: 177, length: 9, replacement: Hello}]}], linkedEditGroups: [{positions: [{file: d:\Work\flutter_extensions\dart_custom_lint\packages\custom_lint\example\lib\main.dart, offset: 177}], length: 9, suggestions: []}], id: mycustomlint.assist.change.something}}]}
I think it should be valid.. However I'll try again
@MassimoTambu any chance you were you able to get this working?
I just started trying to implement quick assists in custom_lint, but also could not get it working at all. I then tried to do the same on a plugin I've created (its using analyzer_plugin
v0.11.1, however) and was able to get it working fine, so either we both didn't implement it correctly or possibly the issue may be somewhere in custom_lint or analyzer_plugin v0.10.0 (and may already be fixed), but I haven't been able to debug too deeply yet.
Nope, not yet.
I tried to imitate how custom_lint
works with Lint
but using Quick Assist. As I wrote before, I successfully subscribed to quick assist events, but I cannot show them in the IDE.
I think maybe there's something missing with the sending part to the IDE.
This will be available in the next version (0.1.0)