From e16bf25a914c6df7595a7b316d399620a321c4f2 Mon Sep 17 00:00:00 2001 From: Daniel Kempkens Date: Sat, 15 Jul 2023 01:07:28 +0200 Subject: [PATCH] nvim: Only start certain LS if the binary exists --- home/config/nvim/plugins/lsp.fnl | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/home/config/nvim/plugins/lsp.fnl b/home/config/nvim/plugins/lsp.fnl index 7e19ca6..496e078 100644 --- a/home/config/nvim/plugins/lsp.fnl +++ b/home/config/nvim/plugins/lsp.fnl @@ -45,12 +45,15 @@ (each [_ name (pairs default-servers)] ((. lsp name :setup) default-config)) ;; Custom - (lsp.elixirls.setup (->> {:cmd [:elixir-ls]} - (vim.tbl_extend :force default-config))) - (lsp.nil_ls.setup (->> {:settings {:nil {:formatting {:command [:nixpkgs-fmt]}}}} - (vim.tbl_extend :force default-config))) - ;; (lsp.nixd.setup (->> {:settings {:formatting {:command [:nixpkgs-fmt]}}} - ;; (vim.tbl_extend :force default-config))) + (when (= (vim.fn.executable :elixir-ls) 1) + (lsp.elixirls.setup (->> {:cmd [:elixir-ls]} + (vim.tbl_extend :force default-config)))) + (when (= (vim.fn.executable :nil) 1) + (lsp.nil_ls.setup (->> {:settings {:nil {:formatting {:command [:nixpkgs-fmt]}}}} + (vim.tbl_extend :force default-config)))) + (when (= (vim.fn.executable :nixd) 1) + (lsp.nixd.setup (->> {:settings {:formatting {:command [:nixpkgs-fmt]}}} + (vim.tbl_extend :force default-config)))) (let [inlay-hints {:includeInlayParameterNameHints :all :includeInlayParameterNameHintsWhenArgumentMatchesName false :includeInlayFunctionParameterTypeHints true