nix-infra/modules/home/nvim/lua/plugins/lsp.lua

76 lines
1.4 KiB
Lua

return {
{
"neovim/nvim-lspconfig",
opts = {
servers = {
nil_ls = {
settings = {
["nil"] = {
formatting = {
command = { "nixpkgs-fmt" },
},
},
},
},
rust_analyzer = {
settings = {
["rust_analyzer"] = {
check = {
command = "clippy",
},
completion = {
fullFunctionSignatures = {
enable = true,
},
},
diagnostics = {
styleLints = {
enable = true,
},
},
imports = {
granularity = {
enforce = true,
},
},
},
},
},
jsonls = {
-- lazy-load schemastore when needed
on_new_config = function(new_config)
new_config.settings.json.schemas = new_config.settings.json.schemas or {}
vim.list_extend(new_config.settings.json.schemas, require("schemastore").json.schemas())
end,
settings = {
json = {
format = {
enable = true,
},
validate = { enable = true },
},
},
},
marksman = {},
ruff_lsp = {
keys = {
{
"<leader>co",
function()
vim.lsp.buf.code_action({
apply = true,
context = {
only = { "source.organizeImports" },
diagnostics = {},
},
})
end,
desc = "Organize Imports",
},
},
},
hls = {},
},
},
},
}