From: Andreas Louv Date: Sat, 20 May 2023 19:39:29 +0000 (+0200) Subject: Add example for how to filter diagnostics X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=b6a0d76a933ea295f7c350178e0914435b3e5d91;p=vim-lsp.git Add example for how to filter diagnostics --- diff --git a/doc/lsp.txt b/doc/lsp.txt index 2cf47b7..551a352 100644 --- a/doc/lsp.txt +++ b/doc/lsp.txt @@ -326,7 +326,22 @@ Additionally the following configurations can be made: language server diagnostics and returns a new list of filtered, or otherwise changed diagnostics. Can be used to remove unwanted diagnostics, prefix the diagnostics - text, etc. + text, etc. The following example will remove all but + errors and warnings: > + + vim9script + g:LspAddServer([{ + filetype: ['javascript', 'typescript'], + path: '/usr/local/bin/typescript-language-server', + args: ['--stdio'], + processDiagHandler: (diags: list>) => { + # Only include errors and warnings + return diags->filter((diag, ix) => { + return diag.severity <= 2 + }) + }, + }]) +< *lsp-cfg-syncInit* syncInit (Optional) for language servers (e.g. rust analyzer, gopls, etc.) that take time to initialize and reply to