autoload/lsp/codeaction.vim | 8 +++++++- autoload/lsp/options.vim | 4 +++- doc/lsp.txt | 1 + diff --git a/autoload/lsp/codeaction.vim b/autoload/lsp/codeaction.vim index 5a34d908c7c2d8303434200c4ecd2b0d123875da..ca3d664b72fa3090b031e1f1800f477704c19509 100644 --- a/autoload/lsp/codeaction.vim +++ b/autoload/lsp/codeaction.vim @@ -43,7 +43,13 @@ DoCommand(lspserver, selAction) endif enddef -export def ApplyCodeAction(lspserver: dict, actions: list>): void +export def ApplyCodeAction(lspserver: dict, actionlist: list>): void + var actions = actionlist + + if opt.lspOptions.hideDisabledCodeActions + actions = actions->filter((ix, act) => !act->has_key('disabled')) + endif + if actions->empty() # no action can be performed util.WarnMsg('No code action is available') diff --git a/autoload/lsp/options.vim b/autoload/lsp/options.vim index 8aa8f8f8a58feaa169decd2ad8cae302dd4b8408..c8dc2fbd5a696fe98822c1ccc1c2a229fc44291f 100644 --- a/autoload/lsp/options.vim +++ b/autoload/lsp/options.vim @@ -43,7 +43,9 @@ usePopupInCodeAction: false, # enable snippet completion support snippetSupport: false, # enable inlay hints - showInlayHints: false + showInlayHints: false, + # hide disabled code actions + hideDisabledCodeActions: false } # set the LSP plugin options from the user provided option values diff --git a/doc/lsp.txt b/doc/lsp.txt index 030d96df63bccbae6d514426d26e721d1af26079..02d270e4eeb8857736cccc5301a17521b493b315 100644 --- a/doc/lsp.txt +++ b/doc/lsp.txt @@ -282,6 +282,7 @@ Use `NONE` to disable. echoSignature In insert mode, echo the current symbol signature instead of showing it in a popup. By default this is set to false. +hideDisabledCodeActions Hide all disabled code actions ignoreMissingServer Do not print a missing language server executable. By default this is set to false. keepFocusInReferences Focus on the location list window after