home: vim: lspconfig: simplify LSP config
All checks were successful
ci/woodpecker/push/check Pipeline was successful
All checks were successful
ci/woodpecker/push/check Pipeline was successful
Despite what I just said in the previous commit, I decided to remove the `is_executable` checks and always enable all servers. I figured out that NeoVim actually handles `PATH` modifications pretty well in this scenario: making a previously unavailable server executable will automatically enable it.
This commit is contained in:
parent
62533d435b
commit
6b1b5300cd
1 changed files with 26 additions and 47 deletions
|
|
@ -30,38 +30,20 @@ vim.lsp.config("*", {
|
||||||
on_attach = lsp.on_attach,
|
on_attach = lsp.on_attach,
|
||||||
})
|
})
|
||||||
|
|
||||||
-- C/C++
|
local servers = {
|
||||||
if utils.is_executable("clangd") then
|
-- C/C++
|
||||||
vim.lsp.enable("clangd")
|
clangd = {},
|
||||||
end
|
-- Haskell
|
||||||
|
hls = {},
|
||||||
-- Haskell
|
-- Nix
|
||||||
if utils.is_executable("haskell-language-server-wrapper") then
|
nil_ls = {},
|
||||||
vim.lsp.enable("hls")
|
-- Python
|
||||||
end
|
pyright = {},
|
||||||
|
ruff = {},
|
||||||
-- Nix
|
-- Rust
|
||||||
if utils.is_executable("nil") then
|
rust_analyzer = {},
|
||||||
vim.lsp.enable("nil_ls")
|
-- Shell
|
||||||
end
|
bashls = {
|
||||||
|
|
||||||
-- Python
|
|
||||||
if utils.is_executable("pyright") then
|
|
||||||
vim.lsp.enable("pyright")
|
|
||||||
end
|
|
||||||
|
|
||||||
if utils.is_executable("ruff") then
|
|
||||||
vim.lsp.enable("ruff")
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Rust
|
|
||||||
if utils.is_executable("rust-analyzer") then
|
|
||||||
vim.lsp.enable("rust_analyzer")
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Shell
|
|
||||||
if utils.is_executable("bash-language-server") then
|
|
||||||
vim.lsp.config("bashls", {
|
|
||||||
filetypes = { "bash", "sh", "zsh" },
|
filetypes = { "bash", "sh", "zsh" },
|
||||||
settings = {
|
settings = {
|
||||||
bashIde = {
|
bashIde = {
|
||||||
|
|
@ -73,20 +55,17 @@ if utils.is_executable("bash-language-server") then
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
},
|
||||||
vim.lsp.enable("bashls")
|
-- Starlark
|
||||||
end
|
starpls = {},
|
||||||
|
-- Generic
|
||||||
|
harper_ls = {},
|
||||||
|
typos_lsp = {},
|
||||||
|
}
|
||||||
|
|
||||||
-- Starlark
|
for server, config in pairs(servers) do
|
||||||
if utils.is_executable("starpls") then
|
if not vim.tbl_isempty(config) then
|
||||||
vim.lsp.enable("starpls")
|
vim.lsp.config(server, config)
|
||||||
end
|
end
|
||||||
|
vim.lsp.enable(server)
|
||||||
-- Generic
|
|
||||||
if utils.is_executable("harper-ls") then
|
|
||||||
vim.lsp.enable("harper_ls")
|
|
||||||
end
|
|
||||||
|
|
||||||
if utils.is_executable("typos-lsp") then
|
|
||||||
vim.lsp.enable("typos_lsp")
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue