]> Sergey Matveev's repositories - vim-lsp.git/commitdiff
add diagnostics signs options
authorOleksiy Hryshchenko <greeschenko@gmail.com>
Wed, 29 Mar 2023 17:58:04 +0000 (20:58 +0300)
committerOleksiy Hryshchenko <greeschenko@gmail.com>
Wed, 29 Mar 2023 17:58:04 +0000 (20:58 +0300)
autoload/lsp/diag.vim
autoload/lsp/options.vim
doc/lsp.txt

index 2f868ed8147ea30a523b02dd52572947a4411f85..18c247b36bc8cabc7d619b7fd8b76ba99a44ee52 100644 (file)
@@ -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')
index bda616f2e5b375c5a743fc8401caecf720f40c1b..f8e648e9fe3d638b68b10950633a7d9085a92d0f 100644 (file)
@@ -53,6 +53,25 @@ export var lspOptions: dict<any> = {
   # 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
index 639ae12e064b0bd371a68e54d7fb19aed75e5731..10e353da9291d5d2ac9c93a67f84fe5523e811d9 100644 (file)
@@ -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<any>| 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: >