2022-03-08 20:18:02 +01:00
|
|
|
local lspconfig = require("lspconfig")
|
2022-03-08 20:20:22 +01:00
|
|
|
local lsp = require("ambroisie.lsp")
|
2022-03-01 15:22:59 +01:00
|
|
|
local utils = require("ambroisie.utils")
|
|
|
|
|
2023-06-22 17:35:30 +02:00
|
|
|
-- Diagnostics
|
|
|
|
vim.diagnostic.config({
|
|
|
|
-- Disable virtual test next to affected regions
|
|
|
|
virtual_text = false,
|
|
|
|
-- Also disable virtual diagnostics under the affected regions
|
|
|
|
virtual_lines = false,
|
|
|
|
-- Show diagnostics signs
|
|
|
|
signs = true,
|
|
|
|
-- Underline offending regions
|
|
|
|
underline = true,
|
|
|
|
-- Do not bother me in the middle of insertion
|
|
|
|
update_in_insert = false,
|
|
|
|
-- Show highest severity first
|
|
|
|
severity_sort = true,
|
|
|
|
})
|
|
|
|
|
2022-03-04 17:36:01 +01:00
|
|
|
-- Inform servers we are able to do completion, snippets, etc...
|
2022-11-03 17:59:34 +01:00
|
|
|
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
2022-03-04 17:36:01 +01:00
|
|
|
|
2022-03-01 15:23:42 +01:00
|
|
|
-- C/C++
|
|
|
|
if utils.is_executable("clangd") then
|
2022-03-08 20:18:02 +01:00
|
|
|
lspconfig.clangd.setup({
|
2022-03-04 17:36:01 +01:00
|
|
|
capabilities = capabilities,
|
2022-03-08 20:20:22 +01:00
|
|
|
on_attach = lsp.on_attach,
|
2022-03-01 15:23:42 +01:00
|
|
|
})
|
|
|
|
end
|
|
|
|
|
2024-03-11 13:04:38 +01:00
|
|
|
-- Haskell
|
|
|
|
if utils.is_executable("haskell-language-server-wrapper") then
|
|
|
|
lspconfig.hls.setup({
|
|
|
|
capabilities = capabilities,
|
|
|
|
on_attach = lsp.on_attach,
|
|
|
|
})
|
|
|
|
end
|
|
|
|
|
2022-03-04 14:20:29 +01:00
|
|
|
-- Nix
|
2023-05-03 19:09:14 +02:00
|
|
|
if utils.is_executable("nil") then
|
|
|
|
lspconfig.nil_ls.setup({
|
|
|
|
capabilities = capabilities,
|
|
|
|
on_attach = lsp.on_attach,
|
|
|
|
})
|
|
|
|
end
|
|
|
|
|
2022-03-01 15:22:59 +01:00
|
|
|
-- Python
|
|
|
|
if utils.is_executable("pyright") then
|
2022-03-08 20:18:02 +01:00
|
|
|
lspconfig.pyright.setup({
|
2022-03-04 17:36:01 +01:00
|
|
|
capabilities = capabilities,
|
2022-03-08 20:20:22 +01:00
|
|
|
on_attach = lsp.on_attach,
|
2022-03-01 15:22:59 +01:00
|
|
|
})
|
|
|
|
end
|
2022-03-01 15:23:20 +01:00
|
|
|
|
2024-03-11 13:01:15 +01:00
|
|
|
if utils.is_executable("ruff-lsp") then
|
|
|
|
lspconfig.ruff_lsp.setup({
|
|
|
|
capabilities = capabilities,
|
|
|
|
on_attach = lsp.on_attach,
|
|
|
|
})
|
|
|
|
end
|
|
|
|
|
2022-03-01 15:23:20 +01:00
|
|
|
-- Rust
|
|
|
|
if utils.is_executable("rust-analyzer") then
|
2022-03-08 20:18:02 +01:00
|
|
|
lspconfig.rust_analyzer.setup({
|
2022-03-04 17:36:01 +01:00
|
|
|
capabilities = capabilities,
|
2022-03-08 20:20:22 +01:00
|
|
|
on_attach = lsp.on_attach,
|
2022-03-01 15:23:20 +01:00
|
|
|
})
|
|
|
|
end
|
2024-03-11 13:20:53 +01:00
|
|
|
|
|
|
|
-- Shell
|
|
|
|
if utils.is_executable("bash-language-server") then
|
|
|
|
lspconfig.bashls.setup({
|
|
|
|
filetypes = { "bash", "sh", "zsh" },
|
|
|
|
capabilities = capabilities,
|
|
|
|
on_attach = lsp.on_attach,
|
|
|
|
})
|
|
|
|
end
|