lspsaga.nvim
lspsaga.nvim copied to clipboard
Code action improvements
There are a few things that I think can be improved for :Lspsaga code_action
:
- the lightbulb will always be shown, regardless of where the cursor position is within a line: Current behavior:
Expected behavior:
The code action for [1] Add import:: "io"
should only be shown when above the io
identifier. This is how VSCode behaves.
- add option to filter code action items based on their kind
- Current behavior:
All code actions are shown when using :Lspsaga code_action
regardless of the kind
(both quickfix
and source.organizeImports
).
-
Expected behavior: It would be nice to be able to filter them, e.g. only show
quickfix
and not global code actions such asorganizeImports
.
- E.g. the Golang LSP server can send additional diagnostics for an error. It would be nice to show them in Lspsaga's window. Example response:
diagnostics = {
{
code = "UndeclaredName",
codeDescription = {
href = "https://pkg.go.dev/golang.org/x/tools/internal/typesinternal?utm_source=gopls#UndeclaredName",
},
message = "undeclared name: io",
range = {
["end"] = {
character = 14,
line = 92,
},
start = {
character = 12,
line = 92,
},
},
severity = 1,
source = "compiler",
},
}
This is how VSCode shows this info:
Do you think these are improvements that you want to include in your plugin?
I will accept any suggestion for improvement. My aim is to make lspsaga have a great ui. Have you used lspsaga's diagnostic yet. I also looked at vscode for this behavior. I think it is showing the behavior of the diagnosis and not the codeaction right? I implement it in jump diagnostic.
about lightbulb .seems like jump to floatwindow it's disappear. if not it always in. I will fix it later.
add option to filter code action items based on their kind
why not !! good catch.
there will have a new ui because I am implement title in border in upstream now . It's done right away. Need to write some test code.
Have you used lspsaga's diagnostic yet
I haven't, thank you - that looks really nice!
I think it is showing the behavior of the diagnosis and not the codeaction right? I implement it in jump diagnostic.
Yes, I think it would be nice to show the code action and diagnostic information combined so users can fix it immediately. (for me the QuickFixKey: ga
text is not shown so I can't run the code action directly)
right if there has diagnostic when jump it we can show diagnostic and codeaction. then quick fix not press another shortcut.
just a draft. ui not complete. diagnostic jump with code action . any suggest