dart_custom_lint icon indicating copy to clipboard operation
dart_custom_lint copied to clipboard

Support for Quick Assists

Open MassimoTambu opened this issue 2 years ago • 4 comments

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?

MassimoTambu avatar Jul 15 '22 16:07 MassimoTambu

Sure.

rrousselGit avatar Jul 15 '22 16:07 rrousselGit

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 avatar Jul 17 '22 08:07 MassimoTambu

@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.

pattobrien avatar Aug 26 '22 16:08 pattobrien

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.

MassimoTambu avatar Aug 26 '22 17:08 MassimoTambu

This will be available in the next version (0.1.0)

rrousselGit avatar Jan 06 '23 07:01 rrousselGit