Bruno BELANYI
dc27b59912
Since `none-ls` has removed their `shellcheck` built-in. This actually makes the diagnostics more robust to POSIX/non-POSIX scripts (the LSP server detects it at runtime, which is more robust than the `ftdetect` scripts). Nice bonus: the shellcheck code is shown in the diagnostics message without any configuration! I'm not sure if I can configure `avoid-nullary-conditions` -- though it seems like this check is broken at the moment (I couldn't get it to trigger during my tests).
86 lines
2 KiB
Lua
86 lines
2 KiB
Lua
local lspconfig = require("lspconfig")
|
|
local lsp = require("ambroisie.lsp")
|
|
local utils = require("ambroisie.utils")
|
|
|
|
-- 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,
|
|
})
|
|
|
|
-- 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
|
|
|
|
-- 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
|
|
|
|
if utils.is_executable("rnix-lsp") then
|
|
lspconfig.rnix.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-lsp") then
|
|
lspconfig.ruff_lsp.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" },
|
|
capabilities = capabilities,
|
|
on_attach = lsp.on_attach,
|
|
})
|
|
end
|