autoload/lsp/diag.vim | 34 ++++++++++++++++++++++++++-------- autoload/lsp/options.vim | 19 +++++++++++++++++++ doc/lsp.txt | 22 ++++++++++++++++++++++ diff --git a/autoload/lsp/diag.vim b/autoload/lsp/diag.vim index 2f868ed8147ea30a523b02dd52572947a4411f85..18c247b36bc8cabc7d619b7fd8b76ba99a44ee52 100644 --- a/autoload/lsp/diag.vim +++ b/autoload/lsp/diag.vim @@ -10,14 +10,32 @@ # Initialize the signs and the text property type used for diagnostics. export def InitOnce() var lineHL: string = opt.lspOptions.diagLineHL # Signs used for LSP diagnostics - sign_define([{name: 'LspDiagError', text: 'E>', texthl: 'ErrorMsg', - linehl: lineHL}, - {name: 'LspDiagWarning', text: 'W>', texthl: 'Search', - linehl: lineHL}, - {name: 'LspDiagInfo', text: 'I>', texthl: 'Pmenu', - linehl: lineHL}, - {name: 'LspDiagHint', text: 'H>', texthl: 'Question', - linehl: lineHL}]) + sign_define([ + { + name: 'LspDiagError', + text: opt.lspOptions.diagSignOpts.error.text, + texthl: opt.lspOptions.diagSignOpts.error.texthl, + linehl: lineHL + }, + { + name: 'LspDiagWarning', + text: opt.lspOptions.diagSignOpts.warning.text, + texthl: opt.lspOptions.diagSignOpts.warning.texthl, + linehl: lineHL + }, + { + name: 'LspDiagInfo', + text: opt.lspOptions.diagSignOpts.info.text, + texthl: opt.lspOptions.diagSignOpts.info.texthl, + linehl: lineHL + }, + { + name: 'LspDiagHint', + text: opt.lspOptions.diagSignOpts.hint.text, + texthl: opt.lspOptions.diagSignOpts.hint.texthl, + linehl: lineHL + } + ]) if opt.lspOptions.showDiagWithVirtualText if !hlexists('LspDiagVirtualText') diff --git a/autoload/lsp/options.vim b/autoload/lsp/options.vim index bda616f2e5b375c5a743fc8401caecf720f40c1b..f8e648e9fe3d638b68b10950633a7d9085a92d0f 100644 --- a/autoload/lsp/options.vim +++ b/autoload/lsp/options.vim @@ -53,6 +53,25 @@ hideDisabledCodeActions: false, # icase | fuzzy | case match for language servers that replies with a full # list of completion items completionMatcher: 'case', + # diagnostics signs options + diagSignOpts: { + error: { + text: 'E>', + texthl: 'ErrorMsg', + }, + warning: { + text: 'W>', + texthl: 'Search', + }, + info: { + text: 'I>', + texthl: 'Pmenu', + }, + hint: { + text: 'H>', + texthl: 'Question', + }, + }, } # set the LSP plugin options from the user provided option values diff --git a/doc/lsp.txt b/doc/lsp.txt index 639ae12e064b0bd371a68e54d7fb19aed75e5731..10e353da9291d5d2ac9c93a67f84fe5523e811d9 100644 --- a/doc/lsp.txt +++ b/doc/lsp.txt @@ -351,6 +351,28 @@ usePopupInCodeAction |Boolean| option. When using the |:LspCodeAction| command to display the code action for the current line, use a popup menu instead of echoing. By default this is set to false. +diagSignOpts |dict| option. Options that allow you to change diagnostic + sings text and highlight + default settings + diagSignOpts: { + error: { + text: 'E>', + texthl: 'ErrorMsg', + }, + warning: { + text: 'W>', + texthl: 'Search', + }, + info: { + text: 'I>', + texthl: 'Pmenu', + }, + hint: { + text: 'H>', + texthl: 'Question', + }, + }, + For example, to disable the automatic placement of signs for the LSP diagnostic messages, you can add the following line to your .vimrc file: >