You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Analyzer plugin fixes and assists are not available when using LSP #3502
Hi! I'm one of the authors of Dart Code Metrics, and we use analyzer plugin API (like sending AnalysisErrorFixes, etc.) to communicate with the analysis server. If I enable LSP preview in VSCode and have the plugin enabled, VSCode starts to display diagnostics without quick fixes. For example,
It works fine when LSP preview is disabled.
Could there be a problem with the analysis server?
Are the fixes that are missing from your plugin, or all fixes? Could you try enabling the analysis servers instrumentation log to see if any errors are recorded?
If you can provide a small repro I can use (and confirm the exact version of the SDK you're using), that may help too. Thanks!
changed the title [-]Enabled LSP preview is not working with a quick fixes from the analyzer plugin as expected.[/-][+]Analyzer plugin fixes and assists are not available when using LSP[/+]on Jul 29, 2021
@dkrutskikh that new "fix all" command is equivalent to running "dart fix". It doesn't include all fixes, only a subset that have been chosen that are safe to apply together and that are very likely the correct fix for the error.
I don't think it includes plugins (or how feasible it would be) - @bwilkerson may have more information about this than I.
No, we don't currently have support for plugins to contribute to the set of fixes applied by the dart fix command. That support does seem like something we should look into adding, though there might be some interesting challenges around the area of conflicting edits. If that's a feature you're plugin would use, please open an issue here: https://github.com/dart-lang/sdk/issues/new.
The issue of plugin fixes not showing up is resolved by dart-lang/sdk@00cc25a. Since the change is in the analysis server, it'll show up in a future SDK release rather than a Dart-Code release.
Activity
DanTup commentedon Jul 29, 2021
Are the fixes that are missing from your plugin, or all fixes? Could you try enabling the analysis servers instrumentation log to see if any errors are recorded?
If you can provide a small repro I can use (and confirm the exact version of the SDK you're using), that may help too. Thanks!
dkrutskikh commentedon Jul 29, 2021
@DanTup please look at https://github.com/dkrutskikh/dart_lsp_quickfix_problem. Thanks!
DanTup commentedon Jul 29, 2021
Thanks - I can repro this. Looks like plugin code actions were overlooked when implementing LSP. Working on it - sorry for the bother!
[-]Enabled LSP preview is not working with a quick fixes from the analyzer plugin as expected.[/-][+]Analyzer plugin fixes and assists are not available when using LSP[/+]DanTup commentedon Jul 29, 2021
I've got a change open to add this to the server: https://dart-review.googlesource.com/c/sdk/+/208404/
Since it's an SDK change, it will only show up in a future SDK release though (rather than Dart-Code release).
dkrutskikh commentedon Jul 29, 2021
Thank you, please clarify this fix support new command https://dartcode.org/releases/v3-25/#fix-all-command?
DanTup commentedon Jul 29, 2021
@dkrutskikh that new "fix all" command is equivalent to running "dart fix". It doesn't include all fixes, only a subset that have been chosen that are safe to apply together and that are very likely the correct fix for the error.
I don't think it includes plugins (or how feasible it would be) - @bwilkerson may have more information about this than I.
dkrutskikh commentedon Jul 29, 2021
Anyway, thanks a lot!
bwilkerson commentedon Jul 29, 2021
No, we don't currently have support for plugins to contribute to the set of fixes applied by the
dart fixcommand. That support does seem like something we should look into adding, though there might be some interesting challenges around the area of conflicting edits. If that's a feature you're plugin would use, please open an issue here: https://github.com/dart-lang/sdk/issues/new.[analysis_server] Support plugin fixes/assists for LSP
DanTup commentedon Aug 3, 2021
The issue of plugin fixes not showing up is resolved by dart-lang/sdk@00cc25a. Since the change is in the analysis server, it'll show up in a future SDK release rather than a Dart-Code release.