-
Notifications
You must be signed in to change notification settings - Fork 184
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
Dynamic registrations of source code actions are not supported in "on_save" trigger #2201
Comments
Can you provide more complete log from |
Never mind. I've read the thread in the Dart repo and explanation from the maintainer makes everything clear. As guessed there, we don't consider dynamic registrations of code action provider, or at least not consider the kinds reported. |
Ah ok. Do you consider this a bug then or a feature request? |
I think more like a bug but does it make a difference? :) |
Haha no I guess not. Just thought it might affect the priority of when it gets looked at. Thanks for looking into it |
@DanTup I see some weird behavior that might be a bug. The "fix all" action doesn't fix a missing semicolon as I would expect it to. The "Insert ';'` code action does: Screen.Recording.2023-02-17.at.21.16.57.movThis also affects code actions on save but I think the root issue is with just the "fix all" not working in this case. |
Server responds with empty response to {
"arguments": [
{
"path": "/usr/local/workspace/sublime-packages/LSP/plugin/core/test.dart"
}
],
"command": "edit.fixAll"
} |
@rchl currently the "Fix All" command for Dart does not support all individual fixes. Some of them require some review/tweaking to ensure the edits they produce can be cleanly merged with edits from other fixes. If you want a fix for testing, running Fix All on the following code should remove both var a = '' as String;
var b = '' as String; |
Thanks, that works with the fix. |
Great, thanks for looking at this so quickly! :-) |
Describe the bug
The
lsp_format_on_save
andlsp_code_actions_on_save
do not seem to be supported by code actions that are dynamically registered. The code actions work fine when you run them manually.To Reproduce
lsp_format_on_save
andlsp_code_actions_on_save
forsource.organizeImports
,source.fixAll
, andsource.sortMembers
Expected behavior
The source actions are run on save and the file is updated
Screenshots
If applicable, add screenshots to help explain your problem.
Environment (please complete the following information):
Additional context
I originally filed this issue on the Dart SDK repo as that is where the language server is. I observed that on startup the Dart LSP was not registering any "source" capabilities. It started with the following:
So I thought there might be an issue with the Dart LSP itself. But it turns out that the Dart LSP registers their actions dynamically.
After enabling the Dart LSP log, it is clearly registering the capabilities. It is also registering the "autoTriggered" events. But the file is not being updated:
So the actions work when running manually, the events are showing in the log, but the file is never edited after the save.
The text was updated successfully, but these errors were encountered: