45 lines
2 KiB
Lua
45 lines
2 KiB
Lua
return {
|
|
"mason-org/mason-lspconfig.nvim",
|
|
opts = {},
|
|
dependencies = {
|
|
{ "mason-org/mason.nvim", opts = {} },
|
|
{
|
|
"neovim/nvim-lspconfig",
|
|
dependencies = "folke/which-key.nvim",
|
|
config = function()
|
|
vim.api.nvim_create_autocmd('LspAttach', {
|
|
group = vim.api.nvim_create_augroup('UserLspConfig', {}),
|
|
callback = function(ev)
|
|
-- Enable completion triggered by <c-x><c-o>
|
|
vim.bo[ev.buf].omnifunc = 'v:lua.vim.lsp.omnifunc'
|
|
|
|
-- Buffer local mappings.
|
|
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
|
local opts = { buffer = ev.buf }
|
|
require('which-key').add({
|
|
{ "<leader>l", group = "lsp" },
|
|
|
|
{ '<leader>le', vim.diagnostic.open_float, desc = "Explanation" },
|
|
{ '<leader>ln', vim.diagnostic.goto_next, desc = "Next Issue" },
|
|
{ '<leader>lN', vim.diagnostic.goto_prev, desc = "Previous Issue" },
|
|
{ '<leader>lj', vim.diagnostic.setloclist, desc = "Diagnostic list" },
|
|
|
|
{ '<leader>lD', vim.lsp.buf.declaration, opts, desc = "Declaration" },
|
|
{ '<leader>ld', vim.lsp.buf.definition, opts, desc = "Definition" },
|
|
{ '<leader>lk', vim.lsp.buf.hover, opts, desc = "Hover" },
|
|
{ '<leader>li', vim.lsp.buf.implementation, opts, desc = "Implmentation" },
|
|
{ '<leader>lt', vim.lsp.buf.type_definition, opts, desc = "Type" },
|
|
{ '<leader>lR', vim.lsp.buf.rename, opts, desc = "Rename" },
|
|
{ '<leader>la', vim.lsp.buf.code_action, opts, desc = "Actions" },
|
|
{ '<leader>lr', vim.lsp.buf.references, opts, desc = "References" },
|
|
|
|
{ '<leader>lf', function()
|
|
vim.lsp.buf.format { async = true }
|
|
end, opts }
|
|
})
|
|
end,
|
|
})
|
|
end
|
|
},
|
|
}
|
|
}
|