Add handlers and capabilities default
This commit is contained in:
@@ -1,68 +1,41 @@
|
|||||||
return {
|
return {
|
||||||
{
|
"neovim/nvim-lspconfig",
|
||||||
|
dependencies = {
|
||||||
"williamboman/mason.nvim",
|
"williamboman/mason.nvim",
|
||||||
config = function()
|
|
||||||
require("mason").setup()
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"williamboman/mason-lspconfig.nvim",
|
"williamboman/mason-lspconfig.nvim",
|
||||||
config = function()
|
|
||||||
require("mason-lspconfig").setup({
|
|
||||||
ensure_installed = {
|
|
||||||
"lua_ls",
|
|
||||||
"gopls",
|
|
||||||
"rust_analyzer",
|
|
||||||
"html",
|
|
||||||
"zls",
|
|
||||||
"pyright",
|
|
||||||
"ols",
|
|
||||||
},
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
},
|
},
|
||||||
{
|
config = function()
|
||||||
"neovim/nvim-lspconfig",
|
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||||
config = function()
|
local handlers = {
|
||||||
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { border = "rounded" }),
|
||||||
local handlers = {
|
["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { border = "rounded" }),
|
||||||
["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { border = "rounded" }),
|
}
|
||||||
["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { border = "rounded" }),
|
|
||||||
}
|
|
||||||
|
|
||||||
local lspconfig = require("lspconfig")
|
require("mason").setup()
|
||||||
lspconfig.lua_ls.setup({
|
require("mason-lspconfig").setup({
|
||||||
capabilities = capabilities,
|
ensure_installed = {
|
||||||
handlers = handlers,
|
"lua_ls",
|
||||||
})
|
"gopls",
|
||||||
lspconfig.gopls.setup({
|
"rust_analyzer",
|
||||||
capabilities = capabilities,
|
"html",
|
||||||
handlers = handlers,
|
"zls",
|
||||||
})
|
"pyright",
|
||||||
lspconfig.rust_analyzer.setup({
|
"ols",
|
||||||
capabilities = capabilities,
|
"clangd",
|
||||||
handlers = handlers,
|
},
|
||||||
})
|
handlers = {
|
||||||
lspconfig.html.setup({
|
function(server_name)
|
||||||
capabilities = capabilities,
|
require("lspconfig")[server_name].setup {
|
||||||
handlers = handlers,
|
capabilities = capabilities,
|
||||||
})
|
handlers = handlers
|
||||||
lspconfig.zls.setup({
|
}
|
||||||
capabilities = capabilities,
|
end
|
||||||
handlers = handlers,
|
}
|
||||||
})
|
})
|
||||||
lspconfig.pyright.setup({
|
|
||||||
capabilities = capabilities,
|
vim.keymap.set("n", "K", vim.lsp.buf.hover, {})
|
||||||
handlers = handlers,
|
vim.keymap.set("n", "gd", vim.lsp.buf.definition, {})
|
||||||
})
|
vim.keymap.set({ "n", "v" }, "<leader>ca", vim.lsp.buf.code_action, {})
|
||||||
lspconfig.ols.setup({
|
vim.keymap.set("n", "<leader>cr", vim.lsp.buf.rename, {})
|
||||||
capabilities = capabilities,
|
end,
|
||||||
handlers = handlers,
|
|
||||||
})
|
|
||||||
vim.keymap.set("n", "K", vim.lsp.buf.hover, {})
|
|
||||||
vim.keymap.set("n", "gd", vim.lsp.buf.definition, {})
|
|
||||||
vim.keymap.set({ "n", "v" }, "<leader>ca", vim.lsp.buf.code_action, {})
|
|
||||||
vim.keymap.set("n", "<leader>cr", vim.lsp.buf.rename, {})
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user