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 lsp = require("ambroisie.lsp")
|
||||||
local utils = require("ambroisie.utils")
|
local utils = require("ambroisie.utils")
|
||||||
|
|
||||||
|
|
@ -25,59 +24,27 @@ vim.diagnostic.config({
|
||||||
-- Inform servers we are able to do completion, snippets, etc...
|
-- Inform servers we are able to do completion, snippets, etc...
|
||||||
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||||
|
|
||||||
-- C/C++
|
-- Shared configuration
|
||||||
if utils.is_executable("clangd") then
|
vim.lsp.config("*", {
|
||||||
lspconfig.clangd.setup({
|
capabilities = capabilities,
|
||||||
capabilities = capabilities,
|
on_attach = lsp.on_attach,
|
||||||
on_attach = lsp.on_attach,
|
})
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Haskell
|
local servers = {
|
||||||
if utils.is_executable("haskell-language-server-wrapper") then
|
-- C/C++
|
||||||
lspconfig.hls.setup({
|
clangd = {},
|
||||||
capabilities = capabilities,
|
-- Haskell
|
||||||
on_attach = lsp.on_attach,
|
hls = {},
|
||||||
})
|
-- Nix
|
||||||
end
|
nil_ls = {},
|
||||||
|
-- Python
|
||||||
-- Nix
|
pyright = {},
|
||||||
if utils.is_executable("nil") then
|
ruff = {},
|
||||||
lspconfig.nil_ls.setup({
|
-- Rust
|
||||||
capabilities = capabilities,
|
rust_analyzer = {},
|
||||||
on_attach = lsp.on_attach,
|
-- Shell
|
||||||
})
|
bashls = {
|
||||||
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({
|
|
||||||
filetypes = { "bash", "sh", "zsh" },
|
filetypes = { "bash", "sh", "zsh" },
|
||||||
capabilities = capabilities,
|
|
||||||
on_attach = lsp.on_attach,
|
|
||||||
settings = {
|
settings = {
|
||||||
bashIde = {
|
bashIde = {
|
||||||
shfmt = {
|
shfmt = {
|
||||||
|
|
@ -88,28 +55,17 @@ if utils.is_executable("bash-language-server") then
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
},
|
||||||
end
|
-- Starlark
|
||||||
|
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
|
||||||
lspconfig.starpls.setup({
|
vim.lsp.config(server, config)
|
||||||
capabilities = capabilities,
|
end
|
||||||
on_attach = lsp.on_attach,
|
vim.lsp.enable(server)
|
||||||
})
|
|
||||||
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,
|
|
||||||
})
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue