LSP
LSP copied to clipboard
Plugin does not reflect `lsp_code_actions_on_save` settings
Hello,
in my LSP.sublime-settings i've configured organizeImports
to true and i'm expecting that on save biome will organize imports automatically as is writen in docs. But nonthing happening :thinking: Did i not understand it correctly?
{
"lsp_format_on_save": true,
"lsp_code_actions_on_save": {
"quickfix.biome": true,
"source.organizeImports.biome": true
}
}
The same can apply to quickfix.biome
. But im not sure how to test this option.
We might need to make things less strict because currently LSP only sends the corresponding code action if the server announces support for it in its initialize
response.
Since this functionality is not specified anywhere but rather based on VSCode, we should align with it. VSCode seems to send all user-specified editor.codeActionsOnSave
to every server but interestingly not all together but in a separate requests. So when using biome
in a TS file with editor.codeActionsOnSave
set to:
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit",
"source.fixAll.stylelint": "explicit",
"source.organizeImports.biome": "explicit",
},
I can see 3 separate textDocument/codeAction
request sent to biome:
[Trace - 21:27:10] Sending request 'textDocument/codeAction - (28)'.
Params: {
"textDocument": {
"uri": "file:///usr/local/workspace/.../routes.ts"
},
"range": {
"start": {
"line": 0,
"character": 0
},
"end": {
"line": 283,
"character": 0
}
},
"context": {
"diagnostics": [
{
"range": {
"start": {
"line": 17,
"character": 26
},
"end": {
"line": 17,
"character": 29
}
},
"message": "'req' is declared but its value is never read.",
"code": 6133,
"severity": 4,
"tags": [
1
],
"source": "ts"
},
{
"range": {
"start": {
"line": 86,
"character": 26
},
"end": {
"line": 86,
"character": 29
}
},
"message": "'req' is declared but its value is never read.",
"code": 6133,
"severity": 4,
"tags": [
1
],
"source": "ts"
},
{
"range": {
"start": {
"line": 217,
"character": 26
},
"end": {
"line": 217,
"character": 29
}
},
"message": "'req' is declared but its value is never read.",
"code": 6133,
"severity": 4,
"tags": [
1
],
"source": "ts"
}
],
"only": [
"source.fixAll.eslint"
],
"triggerKind": 2
}
}
where "only" includes a single, different code action in each.
Similar to @hrasekj : I have my LSP.sublime-settings configured to not fix or organize on save, but fixAll is being applied regardless and I can't figure out how to turn it off. My user settings are being ignored.
{
// General settings
"lsp_format_on_save": false,
"lsp_code_actions_on_save": {
"source.fixAll": false,
"source.organizeImports": false,
},
"show_inlay_hints": false,
"semantic_highlighting": true,
// Language server configurations
"clients": {
"zig": {
// the startup command -- what you would type in a terminal
"command": ["/home/vesper/.zls/zls"],
// enable this configuration
"enabled": true,
// the selector that selects which type of buffers this language server attaches to
"selector": "source.zig",
}
}
}
That's an opposite problem to this one. Feel free to create another issue for it.