Open tspiteri opened 4 years ago
Kind = "" comes from the server - I think that someone has to validate if vscode show those as quick fixes as well(most likely it does).
Generally, we should separate the actions into 3 groups:
ATM we have 1(?) and a method which asks you to select from all actions.
cc @flodiebold
I don't know much about this. We will presumably start setting kind
properly in the not too distant future. Personally, I don't use the sidebar, I just have lsp-execute-code-action
bound to a key. We have a lot of code actions, so showing them all in the sidebar could get annoying fast. (And we do set kind
to null
for diagnostic quick fixes, I think.)
@flodiebold The issue I see there is discoverability, where when you're new to rust-analyzer and haven't studied the assist docs you cannot know which actions are available, or even if there are actions available. When I tried to discover actions by simply invoking lsp-execute-code-action at some points, there is a chance that there is only one code action and it will be immediately applied, and then I had to undo/redo a couple times to figure out what just happened.
Related: https://github.com/emacs-lsp/lsp-mode/issues/1237
there is only one code action and it will be immediately applied
See lsp-auto-execute-action
I think ""
is what protocl requires for "no specific kind":
export namespace CodeActionKind {
/**
* Empty kind.
*/
export const Empty: CodeActionKind = '';
https://microsoft.github.io/language-server-protocol/specification#textDocument_codeAction
I don't know if this is a problem in lsp-mode, lsp-ui, or rust-analyzer.
Code actions that should be shown in the sideline are not. I traced the issue to lsp-ui-sideline--code-actions which first thing matches the actions against lsp-ui-sideline-actions-kind-regex. All actions however have their
kind
set to""
. Now ifkind
werenil
the action would be accepted, but""
is not, so the code actions are not shown. I couldn't follow where the""
was coming from, and I have no idea whether""
should be accepted and ignored likenil
or whetherkind
shouldn't be""
.As a workaround, adding
\|^$
(a choice to accept empty strings) to lsp-ui-sideline-actions-kind-regex works.