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

Lightbulb should only be shown for quickfix code actions #1413

Open
dhruvmanila opened this issue Mar 27, 2024 · 0 comments
Open

Lightbulb should only be shown for quickfix code actions #1413

dhruvmanila opened this issue Mar 27, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@dhruvmanila
Copy link

Apologies for highlighting this as an enhancement issue type but I think it's a bug. I don't use this plugin so I don't have the required information for a bug report. I assume that a lot of users of ruff-lsp in Neovim uses this plugin.

We received an issue around the lightbulb functionality that it's always shown even if the code actions are no-op: astral-sh/ruff-lsp#91. This is the case for source level code actions.

To give some context, what ruff-lsp does is provide the source level code action without an edit to inform the client that the server supports it but will compute the edit lazily via the codeAction/resolve request. This means that when a client requests for a code action, it will always contain the source code actions even if there's nothing to do. So, the lightbulb is shown for every line.

My suggestion and what VS Code does as well is to use the only option to filter and get the quickfix code actions to show the lightbulb. Here's a reference to the VS Code implementation: https://github.com/microsoft/vscode/blob/246d700c4604eb5ebdbb561a1a86562bf9217a62/src/vs/workbench/contrib/markers/browser/markersTreeViewer.ts#L619-L649. Refer to line 639 where it filters out the code actions and here's it translates to the CodeActionContext before sending the request.

@dhruvmanila dhruvmanila added the enhancement New feature or request label Mar 27, 2024
@dhruvmanila dhruvmanila changed the title Lightbulb should only show quickfix code actions Lightbulb should only be shown for quickfix code actions Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant