autoload/lsp/diag.vim | 34 ++++++++++++++++++++++++++-------- autoload/lsp/options.vim | 9 +++++++++ doc/lsp.txt | 33 +++++++++++++++++++++++++-------- diff --git a/autoload/lsp/diag.vim b/autoload/lsp/diag.vim index 4661ca75a945cae179527d5bf536b16e181f91fc..2366868d587b4df90248f5d5c9ae04130fb3dc34 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.diagSignErrorText, + texthl: opt.lspOptions.diagSignErrorTexthl, + linehl: lineHL + }, + { + name: 'LspDiagWarning', + text: opt.lspOptions.diagSignWarningText, + texthl: opt.lspOptions.diagSignWarningTexthl, + linehl: lineHL + }, + { + name: 'LspDiagInfo', + text: opt.lspOptions.diagSignInfoText, + texthl: opt.lspOptions.diagSignInfoTexthl, + linehl: lineHL + }, + { + name: 'LspDiagHint', + text: opt.lspOptions.diagSignHintText, + texthl: opt.lspOptions.diagSignHintTexthl, + linehl: lineHL + } + ]) if opt.lspOptions.highlightDiagInline if !hlexists('LspDiagInlineError') diff --git a/autoload/lsp/options.vim b/autoload/lsp/options.vim index 09a76bef33da6adafa073efdcd965019196b2d68..2a779d0927b8469ea8b4ad631286d8fe4c3601e7 100644 --- a/autoload/lsp/options.vim +++ b/autoload/lsp/options.vim @@ -63,6 +63,15 @@ hideDisabledCodeActions: false, # icase | fuzzy | case match for language servers that replies with a full # list of completion items completionMatcher: 'case', + # diagnostics signs options + diagSignErrorText: 'E>', + diagSignErrorTexthl: 'ErrorMsg', + diagSignWarningText: 'W>', + diagSignWarningTexthl: 'Search', + diagSignInfoText: 'I>', + diagSignInfoTexthl: 'Pmenu', + diagSignHintText: 'H>', + diagSignHintTexthl: 'Question', } # set the LSP plugin options from the user provided option values diff --git a/doc/lsp.txt b/doc/lsp.txt index 09b19f66c2fbd211694b7659e950417064dec63e..433df4f98e76a6a58a969ad272acaeba9f653a6f 100644 --- a/doc/lsp.txt +++ b/doc/lsp.txt @@ -287,12 +287,6 @@ server. By default this is set to true. autoPopulateDiags |Boolean| option. Automatically populate the location list with diagnostics from the language server. By default this is set to false. -diagLineHL |String| option. The highlight group used for a line - with one or more diagnostics. By default uses - "DiffAdd". Use "NONE" to disable. -echoSignature |Boolean| option. In insert mode, echo the current - symbol signature instead of showing it in a popup. - By default this is set to false. completionMatcher |String| option. Enable fuzzy or case insensitive completion for language servers that replies with a full list of completion items. Some language servers @@ -306,6 +300,30 @@ This option accepts one of the following values: case - case sensitive matching (default). fuzzy - fuzzy match completion items. icase - ignore case when matching items. +diagLineHL |String| option. The highlight group used for a line + with one or more diagnostics. By default uses + "DiffAdd". Use "NONE" to disable. +diagSignErrorText |String| option. Change diag sign text for errors + By default 'E>' +diagSignErrorTexthl |String| option. Change diag sign highlight for errors + By default 'ErrorMsg', +diagSignWarningText |String| option. Change diag sign text for warnings + By default 'W>', +diagSignWarningTexthl |String| option. Change diag sign highlight for warnings + By default 'Search', +diagSignInfoText |String| option. Change diag sign text for info + By default 'I>', +diagSignInfoTexthl |String| option. Change diag sign text highlight info + By default 'Pmenu', +diagSignHintText |String| option. Change diag sign text for hints + By default 'H>', +diagSignHintTexthl |String| option. Change diag sign highlight for hints + By default 'Question', +diagVirtualTextHL |String| option. The highlight group used for a + diagnostics virtual text. By default uses "LineNr". +echoSignature |Boolean| option. In insert mode, echo the current + symbol signature instead of showing it in a popup. + By default this is set to false. hideDisabledCodeActions |Boolean| option. Hide all the disabled code actions. By default this is set to false. ignoreMissingServer |Boolean| option. Do not print a missing language @@ -339,8 +357,6 @@ the language server with virtual text. By default this is set to false. The "autoHighlightDiags" option should be set to true. Needs Vim version 9.0.1157 or later. -diagVirtualTextHL |String| option. The highlight group used for a - diagnostics virtual text. By default uses "LineNr". showSignature |Boolean| option. In insert mode, automatically show the current symbol signature in a popup. By default this is set to true. @@ -361,6 +377,7 @@ diagInlineInfoHL |String| option. The highlight group used for inline info highlight. By default uses "SpellRare" diagInlineHintHL |String| option. The highlight group used for inline hint highlight. By default uses "SpellLocal" + For example, to disable the automatic placement of signs for the LSP diagnostic messages, you can add the following line to your .vimrc file: >