aboutsummaryrefslogtreecommitdiffstats
path: root/nvim/lua/plugins/lsp.lua
diff options
context:
space:
mode:
Diffstat (limited to 'nvim/lua/plugins/lsp.lua')
-rw-r--r--nvim/lua/plugins/lsp.lua87
1 files changed, 87 insertions, 0 deletions
diff --git a/nvim/lua/plugins/lsp.lua b/nvim/lua/plugins/lsp.lua
new file mode 100644
index 0000000..0089033
--- /dev/null
+++ b/nvim/lua/plugins/lsp.lua
@@ -0,0 +1,87 @@
+local lspconfig = {
+ 'neovim/nvim-lspconfig',
+ lazy = false,
+ dependencies = {
+ 'williamboman/mason.nvim',
+ 'williamboman/mason-lspconfig'
+ },
+ keys = {
+ {
+ 'gd',
+ function()
+ vim.lsp.buf.definition()
+ end,
+ mode = 'n',
+ desc = "Go to definition"
+ },
+ {
+ '<leader>r',
+ function ()
+ vim.lsp.buf.rename()
+ end,
+ mode = 'n',
+ desc = "Rename symbol"
+ },
+ {
+ '<leader>la',
+ function ()
+ vim.lsp.buf.code_action()
+ end,
+ mode = {'n', 's'},
+ desc = "Show code actions"
+ },
+ {
+ '<leader>lr',
+ function ()
+ vim.lsp.buf.references()
+ end,
+ mode = 'n',
+ desc = "Add symbol references to qf"
+ },
+ {
+ '<C-h>',
+ function ()
+ vim.lsp.buf.signature_help()
+ end,
+ mode = 'i',
+ desc = "Show signature help"
+ }
+ }
+}
+
+local mason = {
+ 'williamboman/mason.nvim',
+ opts = {}
+}
+
+local mason_lspconfig = {
+ 'williamboman/mason-lspconfig.nvim',
+ dependencies = {
+ 'williamboman/mason.nvim',
+ },
+ opts = {
+ handlers = {
+ function(server_name)
+ require('lspconfig')[server_name].setup({})
+ end
+ },
+ ["lua_ls"] = function ()
+ require('lspconfig').lua_ls.setup({
+ settings = {
+ Lua = {
+ diagnostics = {
+ globals = { "vim" }
+ }
+ }
+ }
+ })
+ end
+ }
+}
+
+
+return {
+ mason,
+ mason_lspconfig,
+ lspconfig,
+}