nvimdev / nvimdev/lspsaga.nvim

Lightbulb should only be shown for quickfix code actions

Open
#1,413 0 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Lua
Stars
3.8k
Forks
308
PR merge metrics
No merged PRs in 30d

Description

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: https://github.com/astral-sh/ruff-lsp/issues/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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No repository file or test is named. Search the code-action and lightbulb handling, then inspect how requests are built and whether the LSP context can filter for quickfix actions. Done means the lightbulb is not shown for source actions with no applicable edits, while quickfix actions still appear.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua, neovim
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.