From: Oleksiy Hryshchenko Date: Wed, 29 Mar 2023 17:58:04 +0000 (+0300) Subject: add diagnostics signs options X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=dbe4dd59ee2539f9e371a16a8b11d7e2e84db60d;p=vim-lsp.git add diagnostics signs options --- diff --git a/autoload/lsp/diag.vim b/autoload/lsp/diag.vim index 2f868ed..18c247b 100644 --- a/autoload/lsp/diag.vim +++ b/autoload/lsp/diag.vim @@ -10,14 +10,32 @@ import './util.vim' 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 bda616f..f8e648e 100644 --- a/autoload/lsp/options.vim +++ b/autoload/lsp/options.vim @@ -53,6 +53,25 @@ export var lspOptions: dict = { # 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 639ae12..10e353d 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: >