]> Sergey Matveev's repositories - vim-lsp.git/commitdiff
Add example for how to prefix diagnostics messages
authorAndreas Louv <andreas@louv.dk>
Sat, 20 May 2023 19:39:39 +0000 (21:39 +0200)
committerAndreas Louv <andreas@louv.dk>
Sat, 20 May 2023 21:15:21 +0000 (23:15 +0200)
doc/lsp.txt

index 551a35265e43a31ccb0c9aa2b37fa18e9b94d108..0a621b4aae68329f8551bbe5eb439ca965a0d483 100644 (file)
@@ -341,6 +341,22 @@ Additionally the following configurations can be made:
                                })
                        },
                }])
+<
+                       And this example will prefix the diagnostic message with
+                       the string "TypeScript: ": >
+
+               vim9script
+               g:LspAddServer([{
+                       filetype: ['javascript', 'typescript'],
+                       path: '/usr/local/bin/typescript-language-server',
+                       args: ['--stdio'],
+                       processDiagHandler: (diags: list<dict<any>>) => {
+                               return diags->map((diag, ix) => {
+                                       diag.message = $'TypeScript: {diag.message}'
+                                       return diag
+                               })
+                       },
+               }])
 <
                                                *lsp-cfg-syncInit*
        syncInit        (Optional) for language servers (e.g. rust analyzer,