Compare commits
2 commits
5b47fc6365
...
6b1b5300cd
| Author | SHA1 | Date | |
|---|---|---|---|
| 6b1b5300cd | |||
| 62533d435b |
1 changed files with 31 additions and 75 deletions
|
|
@ -1,4 +1,3 @@
|
|||
local lspconfig = require("lspconfig")
|
||||
local lsp = require("ambroisie.lsp")
|
||||
local utils = require("ambroisie.utils")
|
||||
|
||||
|
|
@ -25,59 +24,27 @@ vim.diagnostic.config({
|
|||
-- Inform servers we are able to do completion, snippets, etc...
|
||||
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||
|
||||
-- C/C++
|
||||
if utils.is_executable("clangd") then
|
||||
lspconfig.clangd.setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = lsp.on_attach,
|
||||
})
|
||||
end
|
||||
-- Shared configuration
|
||||
vim.lsp.config("*", {
|
||||
capabilities = capabilities,
|
||||
on_attach = lsp.on_attach,
|
||||
})
|
||||
|
||||
-- Haskell
|
||||
if utils.is_executable("haskell-language-server-wrapper") then
|
||||
lspconfig.hls.setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = lsp.on_attach,
|
||||
})
|
||||
end
|
||||
|
||||
-- Nix
|
||||
if utils.is_executable("nil") then
|
||||
lspconfig.nil_ls.setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = lsp.on_attach,
|
||||
})
|
||||
end
|
||||
|
||||
-- Python
|
||||
if utils.is_executable("pyright") then
|
||||
lspconfig.pyright.setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = lsp.on_attach,
|
||||
})
|
||||
end
|
||||
|
||||
if utils.is_executable("ruff") then
|
||||
lspconfig.ruff.setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = lsp.on_attach,
|
||||
})
|
||||
end
|
||||
|
||||
-- Rust
|
||||
if utils.is_executable("rust-analyzer") then
|
||||
lspconfig.rust_analyzer.setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = lsp.on_attach,
|
||||
})
|
||||
end
|
||||
|
||||
-- Shell
|
||||
if utils.is_executable("bash-language-server") then
|
||||
lspconfig.bashls.setup({
|
||||
local servers = {
|
||||
-- C/C++
|
||||
clangd = {},
|
||||
-- Haskell
|
||||
hls = {},
|
||||
-- Nix
|
||||
nil_ls = {},
|
||||
-- Python
|
||||
pyright = {},
|
||||
ruff = {},
|
||||
-- Rust
|
||||
rust_analyzer = {},
|
||||
-- Shell
|
||||
bashls = {
|
||||
filetypes = { "bash", "sh", "zsh" },
|
||||
capabilities = capabilities,
|
||||
on_attach = lsp.on_attach,
|
||||
settings = {
|
||||
bashIde = {
|
||||
shfmt = {
|
||||
|
|
@ -88,28 +55,17 @@ if utils.is_executable("bash-language-server") then
|
|||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
end
|
||||
},
|
||||
-- Starlark
|
||||
starpls = {},
|
||||
-- Generic
|
||||
harper_ls = {},
|
||||
typos_lsp = {},
|
||||
}
|
||||
|
||||
-- Starlark
|
||||
if utils.is_executable("starpls") then
|
||||
lspconfig.starpls.setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = lsp.on_attach,
|
||||
})
|
||||
end
|
||||
|
||||
-- Generic
|
||||
if utils.is_executable("harper-ls") then
|
||||
lspconfig.harper_ls.setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = lsp.on_attach,
|
||||
})
|
||||
end
|
||||
|
||||
if utils.is_executable("typos-lsp") then
|
||||
lspconfig.typos_lsp.setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = lsp.on_attach,
|
||||
})
|
||||
for server, config in pairs(servers) do
|
||||
if not vim.tbl_isempty(config) then
|
||||
vim.lsp.config(server, config)
|
||||
end
|
||||
vim.lsp.enable(server)
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue