autoload/lsp/codeaction.vim | 4 ---- autoload/lsp/options.vim | 39 +++++++++++++++++++++++++++++++++++++++ diff --git a/autoload/lsp/codeaction.vim b/autoload/lsp/codeaction.vim index 578603f858652eb04aa6112c6f6eb6bf2b47874d..63d1cae72a50f8e18e60db7b15d4af8deb441e41 100644 --- a/autoload/lsp/codeaction.vim +++ b/autoload/lsp/codeaction.vim @@ -23,10 +23,6 @@ lspserver.executeCommand(selAction) endif enddef -def Print(a: any) - echo string(a) -enddef - export def ApplyCodeAction(lspserver: dict, actions: list>): void if actions->empty() # no action can be performed diff --git a/autoload/lsp/options.vim b/autoload/lsp/options.vim index 5308e83c0482d7754f34c2bcf62da0dd1a193599..a067a543ef517de2e9eb5d4bfcd63b3f19a54655 100644 --- a/autoload/lsp/options.vim +++ b/autoload/lsp/options.vim @@ -36,9 +36,48 @@ # Make diagnostics show in a popup instead of echoing showDiagInPopup: true, # Don't print message when a configured language server is missing. ignoreMissingServer: false, + # Customize all LSP kinds from the completion popup + lspKinds: {}, # Use a floating menu to show the code action menu instead of asking for input usePopupInCodeAction: false } + +export var defaultLspKinds: dict = { + text: 't', + method: 'm', + function: 'f', + constructor: 'C', + field: 'F', + variable: 'v', + class: 'c', + interface: 'i', + module: 'M', + property: 'p', + unit: 'u', + value: 'V', + enum: 'e', + keyword: 'k', + snippet: 'S', + color: 'C', + file: 'f', + reference: 'r', + folder: 'F', + enumMember: 'E', + constant: 'd', + struct: 's', + event: 'E', + operator: 'o', + typeParameter: 'T' +} + +# get a custom LSP kind to use in the completion +export def GetLspKind(name: string): string + if has_key(lspOptions.lspKinds, name) + return lspOptions.lspKinds[name] + endif + + return defaultLspKinds[name] +enddef # set LSP options from user provided options export def OptionsSet(opts: dict)