]> Sergey Matveev's repositories - vim-lsp.git/commitdiff
Make it possible to hide disabled code actions with "hideDisabledCodeActions"
authorAndreas Louv <andreas@louv.dk>
Fri, 10 Mar 2023 23:11:49 +0000 (00:11 +0100)
committerAndreas Louv <andreas@louv.dk>
Sat, 11 Mar 2023 09:07:50 +0000 (10:07 +0100)
autoload/lsp/codeaction.vim
autoload/lsp/options.vim
doc/lsp.txt

index 5a34d908c7c2d8303434200c4ecd2b0d123875da..ca3d664b72fa3090b031e1f1800f477704c19509 100644 (file)
@@ -43,7 +43,13 @@ export def HandleCodeAction(lspserver: dict<any>, selAction: dict<any>)
   endif
 enddef
 
-export def ApplyCodeAction(lspserver: dict<any>, actions: list<dict<any>>): void
+export def ApplyCodeAction(lspserver: dict<any>, actionlist: list<dict<any>>): 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')
index 8aa8f8f8a58feaa169decd2ad8cae302dd4b8408..c8dc2fbd5a696fe98822c1ccc1c2a229fc44291f 100644 (file)
@@ -43,7 +43,9 @@ export var lspOptions: dict<any> = {
   # 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
index 030d96df63bccbae6d514426d26e721d1af26079..02d270e4eeb8857736cccc5301a17521b493b315 100644 (file)
@@ -282,6 +282,7 @@ diagLineHL          Highlight used for diagnostic line.
 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