-
-
Notifications
You must be signed in to change notification settings - Fork 481
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
fix(lsp): unify code actions capabilities #4122
Conversation
CodeActionKind::from("refactor.biome"), | ||
CodeActionKind::from("refactor.extract.biome"), | ||
CodeActionKind::from("refactor.inline.biome"), | ||
CodeActionKind::from("refactor.rewrite.biome"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably these code actions are not available at all? Happy to remove them in this case.
CodSpeed Performance ReportMerging #4122 will not alter performanceComparing Summary
|
The |
According to LSP spec the code action kinds use a hierarchy like |
Thank you. Could you please add a new line to the changelog? After that, we can merge it and release a patch |
The `biome` language server sends to a client specific code actions that the client can use later to send code actions: - `quickfix.biome` - `source.fixAll.biome` - `source.organizeImports.biome` But under the hood the language server accepts not announced code actions such as `quickfix.suppressRule` or `quickfix.suppressRule.biome.suspicious.noDoubleEquals`. Such code actions work in clients that do not rely on code actions capabilities sent before, VSCode for example. The LSP specification (^1) specifies that clients should not send unsupported requests (code actions). This pull request unified code actions and their announcements by applying the following changes: 1. Custom sub-categories like, e.g. `quickfix.*.suspicious.noDoubleEquals` are removed because they are dynamic and announcing them could be hard to maintain. Instead only the base category is used: `quickfix.suppressRule.biome.suspicious.noDoubleEquals` becomes `quickfix.suppressRule.biome`. The code action data already has all required information to handle it on the server side. 2. Adds additional code actions to the list of `code_action_kinds` capabilities. References: 1. https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#codeActionKind
ab7a237
to
20848f7
Compare
I added it under the |
Yes that's the correct section :) thank you @vitallium |
Summary
The
biome
language server sends to a clientspecific code actions that the client can use later to send code actions:
quickfix.biome
source.fixAll.biome
source.organizeImports.biome
But under the hood the language server accepts
not announced code actions such as
quickfix.suppressRule
orquickfix.suppressRule.biome.suspicious.noDoubleEquals
. Such code actions work in clients that do not rely on code actions capabilities sent before, VSCode for example. The LSP specification (^1) specifies that clients should not send unsupported requests (code actions).This pull request unified code actions and their announcements by applying the following changes:
quickfix.*.suspicious.noDoubleEquals
are removed because they are dynamic and announcing them could be hard to maintain. Instead only the base category is used:quickfix.suppressRule.biome.suspicious.noDoubleEquals
becomesquickfix.suppressRule.biome
. The code action data already has all required information to handle it on the server side.code_action_kinds
capabilities.References:
Issue: #4116
Additional information
I am unsure about the compatibility policy for biomejs as this pull request seems to introduce breaking changes. I would appreciate your thoughts on the implementation itself and how we can maintain backward compatibility. Thanks!
Test Plan
Create a simple Typescript file with the following content:
You should see the reported linting error from Biome LSP, but if you click on the available code actions, the
quickfix.suppressRule
option will be missing.