mirror of
https://codeberg.org/leana8959/.files.git
synced 2025-12-06 14:49:14 +00:00
69 lines
1.8 KiB
Lua
69 lines
1.8 KiB
Lua
local mylsp = require("lsp")
|
|
|
|
local servers = {
|
|
clangd = {},
|
|
cssls = {},
|
|
html = {},
|
|
jsonls = {},
|
|
ts_ls = {},
|
|
|
|
taplo = {},
|
|
yamlls = {},
|
|
|
|
bashls = {},
|
|
fish_lsp = {},
|
|
|
|
pyright = {},
|
|
lua_ls = {},
|
|
gopls = {},
|
|
-- -- fix this, it shows spamming message on top
|
|
-- golangci_lint_ls = {},
|
|
tinymist = {},
|
|
nil_ls = {
|
|
settings = {
|
|
["nil"] = { formatting = { command = { "alejandra" } } },
|
|
},
|
|
},
|
|
}
|
|
|
|
vim.diagnostic.config {
|
|
signs = {
|
|
text = {
|
|
[vim.diagnostic.severity.ERROR] = "E",
|
|
[vim.diagnostic.severity.WARN] = "W",
|
|
[vim.diagnostic.severity.INFO] = "I",
|
|
[vim.diagnostic.severity.HINT] = "H",
|
|
},
|
|
},
|
|
severity_sort = true,
|
|
underline = {
|
|
severity = {
|
|
vim.diagnostic.severity.ERROR,
|
|
vim.diagnostic.severity.WARN,
|
|
},
|
|
},
|
|
}
|
|
|
|
-- Helix style border
|
|
local orig_util_open_floating_preview = vim.lsp.util.open_floating_preview
|
|
function vim.lsp.util.open_floating_preview(contents, syntax, opts, ...)
|
|
opts = opts or {}
|
|
opts.border = mylsp.border
|
|
return orig_util_open_floating_preview(contents, syntax, opts, ...)
|
|
end
|
|
|
|
-- Set log level
|
|
vim.lsp.set_log_level("off")
|
|
|
|
-- It is not recommended to break lspconfig into different settings
|
|
-- related: https://github.com/neovim/nvim-lspconfig/issues/970#issuecomment-860080502
|
|
for name, user_config in pairs(servers) do
|
|
local default_config = {
|
|
capabilities = mylsp.capabilities,
|
|
settings = user_config,
|
|
on_attach = function(client, bufno) mylsp.on_attach(client, bufno) end,
|
|
}
|
|
local merged_config = vim.tbl_deep_extend("force", default_config, user_config)
|
|
|
|
require("lspconfig")[name].setup(merged_config)
|
|
end
|