+
Skip to content

fix(lsp): require config and code actions #6557

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

Merged
merged 3 commits into from
Jun 26, 2025
Merged

Conversation

ematipico
Copy link
Member

@ematipico ematipico commented Jun 26, 2025

Summary

This PR closes two bugs.

Closes #6287

To fix this bug, I had to apply the following changes:

  • when loading the configuration, now we check if the configuration folder is empty. If it is empty, and the editor require the configuration, when we return early with ConfigurationStatus::Missed.
  • the language server request textDocument/codeAction must be registered dynamically. We already do so with formatting requests too.

The second bug was related to how we compute the code actions to provide to the editors. I must admit that there was a lot of confusion on my part (and possibly others') in understanding the feature and correctly applying it to the code.

When the client requests textDocument/codeAction, we simply need to provide the code actions available to a diagnostic. Those code actions are the ones that belong to the choices that the editor provides when clicking Cmd + .. This means that we need to provide ALL code actions: the safe fix, the inline suppression and the top-level suppression. The user will choose what they want.

When configuring codeActionsOnSave / code_actions_on_format, the user chooses which ones should be applied among the ones listed.

Given the previous statements, I adjusted the code, and I also added and fixed some checks: we now check both assist and linter.

Important

There's still a small bug where we provide suppressions regardless of whether the action is a lint rule or an assist action. This requires some refactoring that I prefer to tackle in a different PR.

I also updated the label of the fixAll action. This is how it looks like:

Screenshot 2025-06-26 at 11 18 49

Test Plan

I did manual testing in Zed and VSCode and made sure they behave the same.
Updated the tests, and removed one test that doesn't make sense anymore.

Copy link

changeset-bot bot commented Jun 26, 2025

🦋 Changeset detected

Latest commit: 067c84d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 13 packages
Name Type
@biomejs/biome Patch
@biomejs/cli-win32-x64 Patch
@biomejs/cli-win32-arm64 Patch
@biomejs/cli-darwin-x64 Patch
@biomejs/cli-darwin-arm64 Patch
@biomejs/cli-linux-x64 Patch
@biomejs/cli-linux-arm64 Patch
@biomejs/cli-linux-x64-musl Patch
@biomejs/cli-linux-arm64-musl Patch
@biomejs/wasm-web Patch
@biomejs/wasm-bundler Patch
@biomejs/wasm-nodejs Patch
@biomejs/backend-jsonrpc Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@ematipico ematipico requested review from a team June 26, 2025 10:18
@github-actions github-actions bot added A-Project Area: project A-LSP Area: language server protocol labels Jun 26, 2025
Copy link
Contributor

@arendjr arendjr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good stuff!

ematipico and others added 2 commits June 26, 2025 16:06
Co-authored-by: Arend van Beelen jr. <arend@arendjr.nl>
Co-authored-by: Arend van Beelen jr. <arend@arendjr.nl>
@ematipico ematipico merged commit fd68458 into main Jun 26, 2025
3 checks passed
@ematipico ematipico deleted the fix/require-config branch June 26, 2025 15:08
@github-actions github-actions bot mentioned this pull request Jun 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-LSP Area: language server protocol A-Project Area: project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐛 biome.requireConfiguration setting is being ignored
2 participants
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载