nvim/lua/plugins/lsp.lua

67 lines
1.9 KiB
Lua
Raw Normal View History

2023-06-08 16:38:02 -04:00
return {
{
"neovim/nvim-lspconfig",
init = function()
local format = function()
2023-11-01 14:12:01 -04:00
require("lazyvim.util").format({ force = true })
2023-06-08 16:38:02 -04:00
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" }
2023-06-12 09:07:22 -04:00
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { border = "rounded" })
2023-06-12 16:41:51 -04:00
vim.lsp.handlers["textDocument/signatureHelp"] =
vim.lsp.with(vim.lsp.handlers.signature_help, { border = "rounded" })
vim.diagnostic.config({
float = { border = "rounded" },
})
2023-06-08 16:38:02 -04:00
end,
opts = {
2023-11-01 14:12:01 -04:00
-- autoformat = false,
2023-06-12 16:41:51 -04:00
diagnostics = {
update_in_insert = true,
},
servers = {
yamlls = {
settings = {
yaml = {
keyOrdering = false,
},
},
},
2023-06-18 12:59:41 -04:00
rust_analyzer = {
settings = {
["rust-analyzer"] = {
checkOnSave = {
command = "clippy",
},
},
2023-11-01 14:12:01 -04:00
},
},
lua_ls = {
-- mason = false, -- set to false if you don't want this server to be installed with mason
-- Use this to add any additional keymaps
-- for specific lsp servers
root_dir = function()
-- local Path = require('plenary.path')
-- return Path:new(fname):parent().filename
return vim.loop.cwd()
end,
-- ---@type LazyKeys[]
-- keys = {},
settings = {
Lua = {
workspace = {
checkThirdParty = false,
},
completion = {
callSnippet = "Replace",
},
},
},
2023-06-18 12:59:41 -04:00
},
},
2023-06-08 16:38:02 -04:00
},
},
}