feat: added noice
This commit is contained in:
@@ -1,38 +1,80 @@
|
||||
return {
|
||||
{
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
opts = function()
|
||||
local lspconfig = require("lspconfig")
|
||||
"VonHeikemen/lsp-zero.nvim",
|
||||
branch = "v2.x",
|
||||
dependencies = {
|
||||
{ "neovim/nvim-lspconfig" },
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
build = function()
|
||||
pcall(vim.cmd, "MasonUpdate")
|
||||
end,
|
||||
},
|
||||
{ "williamboman/mason-lspconfig.nvim" },
|
||||
},
|
||||
config = function()
|
||||
local lsp = require("lsp-zero")
|
||||
|
||||
local default_capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||
lsp.on_attach(function(client, bufnr)
|
||||
local lsp_opts = { buffer = bufnr, remap = false }
|
||||
|
||||
local lsp_default_capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
vim.keymap.set("n", "gd", function()
|
||||
vim.lsp.buf.definition()
|
||||
end, lsp_opts)
|
||||
vim.keymap.set("n", "gi", function()
|
||||
vim.lsp.buf.implementation()
|
||||
end, lsp_opts)
|
||||
vim.keymap.set("n", "K", function()
|
||||
vim.lsp.buf.hover()
|
||||
end, lsp_opts)
|
||||
vim.keymap.set("n", "<leader>vws", function()
|
||||
vim.lsp.buf.workspace_symbol()
|
||||
end, lsp_opts)
|
||||
vim.keymap.set("n", "<leader>vd", function()
|
||||
vim.diagnostic.open_float()
|
||||
end, lsp_opts)
|
||||
vim.keymap.set("n", "[d", function()
|
||||
vim.diagnostic.goto_next()
|
||||
end, lsp_opts)
|
||||
vim.keymap.set("n", "]d", function()
|
||||
vim.diagnostic.goto_prev()
|
||||
end, lsp_opts)
|
||||
vim.keymap.set("n", "<leader>vca", function()
|
||||
vim.lsp.buf.code_action()
|
||||
end, lsp_opts)
|
||||
vim.keymap.set("n", "<leader>vrr", function()
|
||||
vim.lsp.buf.references()
|
||||
end, lsp_opts)
|
||||
vim.keymap.set("n", "<leader>vrn", function()
|
||||
vim.lsp.buf.rename()
|
||||
end, lsp_opts)
|
||||
vim.keymap.set("i", "<C-h>", function()
|
||||
vim.lsp.buf.signature_help()
|
||||
end, lsp_opts)
|
||||
end)
|
||||
|
||||
local capabilities = vim.tbl_deep_extend("force", {}, lsp_default_capabilities, default_capabilities)
|
||||
|
||||
return {
|
||||
ensure_installed = { "tsserver", "rust_analyzer" },
|
||||
require("mason-lspconfig").setup({
|
||||
ensure_installed = {
|
||||
"tsserver",
|
||||
"eslint",
|
||||
"rust_analyzer",
|
||||
"lua_ls",
|
||||
"jsonls",
|
||||
"html",
|
||||
"tailwindcss",
|
||||
"pylsp",
|
||||
"dockerls",
|
||||
"bashls",
|
||||
"marksman",
|
||||
},
|
||||
handlers = {
|
||||
function(server_name)
|
||||
lspconfig[server_name].setup({
|
||||
capabilities = capabilities,
|
||||
})
|
||||
end,
|
||||
["lua_ls"] = function()
|
||||
lspconfig.lua_ls.setup({
|
||||
settings = {
|
||||
Lua = {
|
||||
diagnostics = {
|
||||
globals = { "vim" },
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
lsp.default_setup,
|
||||
lua_ls = function()
|
||||
require("lspconfig").lua_ls.setup(lsp.nvim_lua_ls())
|
||||
end,
|
||||
},
|
||||
}
|
||||
})
|
||||
end,
|
||||
config = true,
|
||||
},
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
@@ -49,7 +91,7 @@ return {
|
||||
},
|
||||
},
|
||||
inlay_hints = {
|
||||
enabled = true,
|
||||
enabled = false,
|
||||
},
|
||||
servers = {
|
||||
tsserver = {
|
||||
@@ -71,6 +113,8 @@ return {
|
||||
config = function(_, opts)
|
||||
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, {
|
||||
border = "single",
|
||||
virtual_text = true,
|
||||
silent = true,
|
||||
})
|
||||
|
||||
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, {
|
||||
@@ -83,38 +127,11 @@ return {
|
||||
local lsp_opts = { buffer = buffer, remap = false, nowait = true }
|
||||
local client = vim.lsp.get_client_by_id(args.data.client_id)
|
||||
|
||||
vim.keymap.set("n", "gd", function()
|
||||
vim.lsp.buf.definition()
|
||||
end, lsp_opts)
|
||||
vim.keymap.set("n", "K", function()
|
||||
vim.lsp.buf.hover()
|
||||
end, lsp_opts)
|
||||
vim.keymap.set("n", "<leader>vws", function()
|
||||
vim.lsp.buf.workspace_symbol()
|
||||
end, lsp_opts)
|
||||
vim.keymap.set("n", "<leader>vd", function()
|
||||
vim.diagnostic.open_float()
|
||||
end, lsp_opts)
|
||||
vim.keymap.set("n", "[d", function()
|
||||
vim.diagnostic.goto_next()
|
||||
end, lsp_opts)
|
||||
vim.keymap.set("n", "]d", function()
|
||||
vim.diagnostic.goto_prev()
|
||||
end, lsp_opts)
|
||||
vim.keymap.set("n", "<leader>vca", function()
|
||||
vim.lsp.buf.code_action()
|
||||
end, lsp_opts)
|
||||
vim.keymap.set("n", "<leader>vrr", function()
|
||||
vim.lsp.buf.references()
|
||||
end, lsp_opts)
|
||||
vim.keymap.set("n", "<leader>vrn", function()
|
||||
vim.lsp.buf.rename()
|
||||
end, lsp_opts)
|
||||
vim.keymap.set("i", "<C-h>", function()
|
||||
vim.lsp.buf.signature_help()
|
||||
end, lsp_opts)
|
||||
|
||||
if opts.inlay_hints.enabled and client.supports_method("textDocument/inlayHint") then
|
||||
if
|
||||
opts.inlay_hints.enabled
|
||||
and client ~= nil
|
||||
and client.supports_method("textDocument/inlayHint")
|
||||
then
|
||||
vim.lsp.inlay_hint.enable(true)
|
||||
end
|
||||
end,
|
||||
|
||||
Reference in New Issue
Block a user