nvim/lua/plugins/lsp.lua
2023-06-20 15:19:30 -04:00

44 lines
1.2 KiB
Lua

return {
{
"neovim/nvim-lspconfig",
init = function()
local format = function()
require("lazyvim.plugins.lsp.format").format({ force = true })
end
local keys = require("lazyvim.plugins.lsp.keymaps").get()
keys[#keys + 1] = { "<leader>lf", format, desc = "Format Document", has = "documentFormatting" }
keys[#keys + 1] = { "<leader>lf", format, desc = "Format Range", mode = "v", has = "documentRangeFormatting" }
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { border = "rounded" })
vim.lsp.handlers["textDocument/signatureHelp"] =
vim.lsp.with(vim.lsp.handlers.signature_help, { border = "rounded" })
vim.diagnostic.config({
float = { border = "rounded" },
})
end,
opts = {
autoformat = false,
diagnostics = {
update_in_insert = true,
},
servers = {
yamlls = {
settings = {
yaml = {
keyOrdering = false,
},
},
},
rust_analyzer = {
settings = {
["rust-analyzer"] = {
checkOnSave = {
command = "clippy",
},
},
}
},
},
},
},
}