]> Sergey Matveev's repositories - dotfiles.git/blobdiff - vim/.vim/plugin/lsp.vim
Add LSP server only if executable exists
[dotfiles.git] / vim / .vim / plugin / lsp.vim
index c5e1c90ac8b51cc098c98925560e42a927275523..41791c985d730b7a20d76fbbb181cf0bfb407735 100644 (file)
@@ -3,7 +3,9 @@ vim9script
 # go get golang.org/x/tools/gopls@latest
 # pip install 'python-language-server[all]'
 
-var lspServers = [
+var lspServers: list<dict<any>>
+
+for d in [
     {
         filetype: ["c", "cpp"],
         path: "clangd",
@@ -17,7 +19,6 @@ var lspServers = [
     {
         filetype: ["python"],
         path: "pyls",
-        args: ["-v"],
         syncInit: true,
         workspaceConfig: {pyls: {
             configurationSources: ["flake8"],
@@ -25,8 +26,13 @@ var lspServers = [
                 mccabe: {enabled: false},
             },
         }},
-    }
+    },
 ]
+    if executable(d["path"])
+        add(lspServers, d)
+    endif
+endfor
+
 var lspOpts = {
     ignoreMissingServer: true,
     autoComplete: false,