Skip to content
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

Plugin does not reflect lsp_code_actions_on_save settings #2421

Open
hrasekj opened this issue Feb 12, 2024 · 3 comments
Open

Plugin does not reflect lsp_code_actions_on_save settings #2421

hrasekj opened this issue Feb 12, 2024 · 3 comments
Labels

Comments

@hrasekj
Copy link

hrasekj commented Feb 12, 2024

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

@rchl rchl transferred this issue from sublimelsp/LSP-biome Feb 13, 2024
@rchl
Copy link
Member

rchl commented Feb 13, 2024

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.

@rchl rchl added the bug label Feb 13, 2024
@skytwosea
Copy link

skytwosea commented Mar 18, 2024

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",
        }
    }
}

@rchl
Copy link
Member

rchl commented Mar 18, 2024

That's an opposite problem to this one. Feel free to create another issue for it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants