nvim/lua/plugins/lsp/init.lua

102 lines
2.6 KiB
Lua
Raw Normal View History

2022-10-09 22:40:29 +02:00
local M = {
2022-10-10 17:24:57 +02:00
event = "BufReadPre",
2022-10-09 22:40:29 +02:00
}
function M.config()
2022-10-10 17:24:57 +02:00
require("lua-dev").setup({
library = {
runtime = "~/projects/neovim/runtime/",
},
})
require("mason")
require("plugins.lsp.diagnostics").setup()
require("fidget").setup({ text = { spinner = "dots" } })
local function on_attach(client, bufnr)
require("nvim-navic").attach(client, bufnr)
require("plugins.lsp.formatting").setup(client, bufnr)
2022-10-12 17:55:25 +02:00
require("plugins.lsp.keys").setup(client, bufnr)
2022-10-10 17:24:57 +02:00
end
2022-10-09 22:40:29 +02:00
2022-10-10 17:24:57 +02:00
---@type lspconfig.options
local servers = {
gopls = {},
rust_analyzer = {
settings = {
["rust-analyzer"] = {
cargo = { allFeatures = true },
checkOnSave = {
command = "clippy",
extraArgs = { "--no-deps" },
},
},
},
},
sumneko_lua = {
single_file_support = true,
settings = {
Lua = {
workspace = {
checkThirdParty = false,
},
completion = {
workspaceWord = false,
},
misc = {
parameters = {
"--log-level=trace",
},
},
diagnostics = {
groupFileStatus = {
["ambiguity"] = "Opened",
["await"] = "Opened",
["codestyle"] = "None",
["duplicate"] = "Opened",
["global"] = "Opened",
["luadoc"] = "Opened",
["redefined"] = "Opened",
["strict"] = "Opened",
["strong"] = "Opened",
["type-check"] = "Opened",
["unbalanced"] = "Opened",
["unused"] = "Opened",
},
unusedLocalExclude = { "_*" },
},
format = {
enable = false,
defaultConfig = {
indent_style = "space",
indent_size = "2",
continuation_indent_size = "2",
},
},
},
},
},
vimls = {},
}
local capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protocol.make_client_capabilities())
capabilities.textDocument.foldingRange = {
dymanicRegistration = false,
lineFoldingOnly = true,
}
2022-10-09 22:40:29 +02:00
2022-10-10 17:24:57 +02:00
---@type _.lspconfig.options
local options = {
on_attach = on_attach,
capabilities = capabilities,
flags = {
2022-10-12 17:55:25 +02:00
debounce_text_changes = 150,
2022-10-10 17:24:57 +02:00
},
}
for server, opts in pairs(servers) do
opts = vim.tbl_deep_extend("force", {}, options, opts or {})
require("lspconfig")[server].setup(opts)
end
2022-10-09 22:40:29 +02:00
2022-10-10 17:24:57 +02:00
require("plugins.null-ls").setup(options)
2022-10-09 22:40:29 +02:00
end
return M