From b6a0d76a933ea295f7c350178e0914435b3e5d91 Mon Sep 17 00:00:00 2001 From: Andreas Louv Date: Sat, 20 May 2023 21:39:29 +0200 Subject: [PATCH] Add example for how to filter diagnostics --- doc/lsp.txt | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) 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 -- 2.48.1