From: Sergey Matveev Date: Tue, 31 Jan 2023 21:49:23 +0000 (+0300) Subject: Add LSP server only if executable exists X-Git-Url: http://www.git.stargrave.org/?p=dotfiles.git;a=commitdiff_plain;h=13ebb247c317e1c491b1a1726f7005360e304ba9 Add LSP server only if executable exists --- diff --git a/vim/.vim/plugin/lsp.vim b/vim/.vim/plugin/lsp.vim index ad6d0a5..41791c9 100644 --- a/vim/.vim/plugin/lsp.vim +++ b/vim/.vim/plugin/lsp.vim @@ -3,7 +3,9 @@ vim9script # go get golang.org/x/tools/gopls@latest # pip install 'python-language-server[all]' -var lspServers = [ +var lspServers: list> + +for d in [ { filetype: ["c", "cpp"], path: "clangd", @@ -24,8 +26,13 @@ var lspServers = [ mccabe: {enabled: false}, }, }}, - } + }, ] + if executable(d["path"]) + add(lspServers, d) + endif +endfor + var lspOpts = { ignoreMissingServer: true, autoComplete: false,