From 13ebb247c317e1c491b1a1726f7005360e304ba9 Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Wed, 1 Feb 2023 00:49:23 +0300 Subject: [PATCH] Add LSP server only if executable exists --- vim/.vim/plugin/lsp.vim | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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, -- 2.44.0