From: Yegappan Lakshmanan Date: Sun, 2 Apr 2023 00:49:26 +0000 (-0700) Subject: Use default highlight groups and remove the highlight groups from options X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=3d7d875c821166fffbb9f4da690fa6329a6826cd;p=vim-lsp.git Use default highlight groups and remove the highlight groups from options --- diff --git a/autoload/lsp/diag.vim b/autoload/lsp/diag.vim index d3a2b4a..5097d2f 100644 --- a/autoload/lsp/diag.vim +++ b/autoload/lsp/diag.vim @@ -8,59 +8,56 @@ import './util.vim' # 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 + hlset([{name: 'LspDiagLine', default: true, linksto: 'DiffAdd'}]) + hlset([{name: 'LspDiagSignErrorText', default: true, linksto: 'ErrorMsg'}]) + hlset([{name: 'LspDiagSignWarningText', default: true, linksto: 'Search'}]) + hlset([{name: 'LspDiagSignInfoText', default: true, linksto: 'Pmenu'}]) + hlset([{name: 'LspDiagSignHintText', default: true, linksto: 'Question'}]) 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 - } + { + name: 'LspDiagError', + text: opt.lspOptions.diagSignErrorText, + texthl: 'LspDiagSignErrorText', + linehl: 'LspDiagLine' + }, + { + name: 'LspDiagWarning', + text: opt.lspOptions.diagSignWarningText, + texthl: 'LspDiagSignWarningText', + linehl: 'LspDiagLine' + }, + { + name: 'LspDiagInfo', + text: opt.lspOptions.diagSignInfoText, + texthl: 'LspDiagSignInfoText', + linehl: 'LspDiagLine' + }, + { + name: 'LspDiagHint', + text: opt.lspOptions.diagSignHintText, + texthl: 'LspDiagSignHintText', + linehl: 'LspDiagLine' + } ]) if opt.lspOptions.highlightDiagInline - if !hlexists('LspDiagInlineError') - hlset([{name: 'LspDiagInlineError', linksto: opt.lspOptions.diagInlineErrorHL}]) - endif - if !hlexists('LspDiagInlineWarning') - hlset([{name: 'LspDiagInlineWarning', linksto: opt.lspOptions.diagInlineWarningHL}]) - endif - if !hlexists('LspDiagInlineInfo') - hlset([{name: 'LspDiagInlineInfo', linksto: opt.lspOptions.diagInlineInfoHL}]) - endif - if !hlexists('LspDiagInlineHint') - hlset([{name: 'LspDiagInlineHint', linksto: opt.lspOptions.diagInlineHintHL}]) - endif - prop_type_add('LspDiagInlineError', { highlight: 'LspDiagInlineError', override: true }) - prop_type_add('LspDiagInlineWarning', { highlight: 'LspDiagInlineWarning', override: true }) - prop_type_add('LspDiagInlineInfo', { highlight: 'LspDiagInlineInfo', override: true }) - prop_type_add('LspDiagInlineHint', { highlight: 'LspDiagInlineHint', override: true }) + hlset([{name: 'LspDiagInlineError', default: true, linksto: 'SpellBad'}]) + hlset([{name: 'LspDiagInlineWarning', default: true, linksto: 'SpellCap'}]) + hlset([{name: 'LspDiagInlineInfo', default: true, linksto: 'SpellRare'}]) + hlset([{name: 'LspDiagInlineHint', default: true, linksto: 'SpellLocal'}]) + prop_type_add('LspDiagInlineError', + { highlight: 'LspDiagInlineError', override: true }) + prop_type_add('LspDiagInlineWarning', + { highlight: 'LspDiagInlineWarning', override: true }) + prop_type_add('LspDiagInlineInfo', + { highlight: 'LspDiagInlineInfo', override: true }) + prop_type_add('LspDiagInlineHint', + { highlight: 'LspDiagInlineHint', override: true }) endif if opt.lspOptions.showDiagWithVirtualText - if !hlexists('LspDiagVirtualText') - hlset([{name: 'LspDiagVirtualText', - linksto: opt.lspOptions.diagVirtualTextHL}]) - endif + hlset([{name: 'LspDiagVirtualText', default: true, linksto: 'LineNr'}]) prop_type_add('LspDiagVirtualText', {highlight: 'LspDiagVirtualText', override: true}) endif diff --git a/autoload/lsp/inlayhints.vim b/autoload/lsp/inlayhints.vim index 37107cd..7c29d09 100644 --- a/autoload/lsp/inlayhints.vim +++ b/autoload/lsp/inlayhints.vim @@ -8,12 +8,8 @@ import './buffer.vim' as buf # Initialize the highlight group and the text property type used for # inlay hints. export def InitOnce() - if !hlexists('LspInlayHintsType') - hlset([{name: 'LspInlayHintsType', linksto: 'Label'}]) - endif - if !hlexists('LspInlayHintsParam') - hlset([{name: 'LspInlayHintsParam', linksto: 'Conceal'}]) - endif + hlset([{name: 'LspInlayHintsType', default: true, linksto: 'Label'}]) + hlset([{name: 'LspInlayHintsParam', default: true, linksto: 'Conceal'}]) prop_type_add('LspInlayHintsType', {highlight: 'LspInlayHintsType'}) prop_type_add('LspInlayHintsParam', {highlight: 'LspInlayHintsParam'}) enddef diff --git a/autoload/lsp/options.vim b/autoload/lsp/options.vim index 411e3e1..3d6d10c 100644 --- a/autoload/lsp/options.vim +++ b/autoload/lsp/options.vim @@ -15,27 +15,11 @@ export var lspOptions: dict = { # icase | fuzzy | case match for language servers that replies with a full # list of completion items completionMatcher: 'case', - # The highlight group used inline Error diagnostics - diagInlineErrorHL: 'SpellBad', - # The highlight group used inline Hint diagnostics - diagInlineHintHL: 'SpellLocal', - # The highlight group used inline Info diagnostics - diagInlineInfoHL: 'SpellRare', - # The highlight group used inline Warning diagnostics - diagInlineWarningHL: 'SpellCap', - # Default diagnostic highlight on lines - diagLineHL: 'DiffAdd', # diagnostics signs options diagSignErrorText: 'E>', - diagSignErrorTexthl: 'ErrorMsg', diagSignHintText: 'H>', - diagSignHintTexthl: 'Question', diagSignInfoText: 'I>', - diagSignInfoTexthl: 'Pmenu', diagSignWarningText: 'W>', - diagSignWarningTexthl: 'Search', - # The highlight group used for a diagnostics virtual text - diagVirtualTextHL: 'LineNr', # In insert mode, echo the current symbol signature in the status line # instead of showing it in a popup echoSignature: false, diff --git a/doc/lsp.txt b/doc/lsp.txt index daa3cb4..1e1422f 100644 --- a/doc/lsp.txt +++ b/doc/lsp.txt @@ -300,35 +300,14 @@ completionMatcher |String| option. Enable fuzzy or case insensitive case - case sensitive matching (default). fuzzy - fuzzy match completion items. icase - ignore case when matching items. -diagInlineErrorHL |String| option. The highlight group used for - inline error highlight. By default uses "SpellBad" -diagInlineHintHL |String| option. The highlight group used for - inline hint highlight. By default uses "SpellLocal" -diagInlineInfoHL |String| option. The highlight group used for - inline info highlight. By default uses "SpellRare" -diagInlineWarningHL |String| option. The highlight group used for - inline warning highlight. By default uses "SpellCap" -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', diagSignHintText |String| option. Change diag sign text for hints By default 'H>', -diagSignHintTexthl |String| option. Change diag sign highlight for hints - By default 'Question', diagSignInfoText |String| option. Change diag sign text for info By default 'I>', -diagSignInfoTexthl |String| option. Change diag sign text highlight info - By default 'Pmenu', diagSignWarningText |String| option. Change diag sign text for warnings By default 'W>', -diagSignWarningTexthl |String| option. Change diag sign highlight for warnings - By default 'Search', -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. @@ -983,6 +962,10 @@ The following highlight groups are used by the LSP plugin. You can define these highlight groups in your .vimrc file before sourcing this plugin to override them. +LspDiagLine Used to highlight a line with one or more + diagnostics. By default linked to the + "DiffAdd" highlight group. Use "NONE" to + disable. LspDiagInlineError Used to highlight inline error diagnostics. By default, linked to the "SpellBad" highlight group. @@ -995,6 +978,14 @@ LspDiagInlineInfo Used to highlight inline info diagnostics. LspDiagInlineWarning Used to highlight inline warning diagnostics. By default, linked to the "SpellCap" highlight group. +LspDiagSignErrorText Used to highlight the sign text for error + diags. By default linked to 'ErrorMsg'. +LspDiagSignHintText Used to highlight the sign text for hint + diags. By default linked to 'Question'. +LspDiagSignInfoText Used to highlight the sign text for info + diags. By default linked to 'Pmenu'. +LspDiagSignWarningText Used to highlight the sign text for warning + diags. By default linked to 'Search'. LspDiagVirtualText Used to highlight diagnostic virtual text. By default, linked to the "LineNr" highlight group.