]> Sergey Matveev's repositories - vim-lsp.git/commitdiff
Use default highlight groups and remove the highlight groups from options
authorYegappan Lakshmanan <yegappan@yahoo.com>
Sun, 2 Apr 2023 00:49:26 +0000 (17:49 -0700)
committerYegappan Lakshmanan <yegappan@yahoo.com>
Sun, 2 Apr 2023 00:49:26 +0000 (17:49 -0700)
autoload/lsp/diag.vim
autoload/lsp/inlayhints.vim
autoload/lsp/options.vim
doc/lsp.txt

index d3a2b4ab63016e82617cb61992333154205575a9..5097d2f21ee43012ad1c1e2e95b17f7d1944aa12 100644 (file)
@@ -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
index 37107cd3f08c1e1d71c096b287c8fdd5dab0fa64..7c29d0968207b54dd54e1d51c4704341a6c83cfc 100644 (file)
@@ -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
index 411e3e195ae105a1e1ba262c6f3087ad80febc3c..3d6d10cce1ae9f769c29959066f0d547c97acf52 100644 (file)
@@ -15,27 +15,11 @@ export var lspOptions: dict<any> = {
   # 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,
index daa3cb441bb5976be86b7982b27224f81052ef9e..1e1422f9f3aede9562e65e6b074e371f7653b2e9 100644 (file)
@@ -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.