diff --git a/neovim/.config/nvim/lua/LSPconfig.lua b/neovim/.config/nvim/lua/LSPconfig.lua index 0f7402b..7e6ad77 100644 --- a/neovim/.config/nvim/lua/LSPconfig.lua +++ b/neovim/.config/nvim/lua/LSPconfig.lua @@ -1,5 +1,3 @@ -local lsp_installer = require("nvim-lsp-installer") - local opts = {} local on_attach = function() @@ -30,4 +28,25 @@ local on_attach = function() set_keymap('', ';lp', 'lua vim.diagnostic.goto_next()', opts) set_keymap('', ';lm', 'lua vim.lsp.buf.formatting()', opts) end -on_attach() +require("mason-lspconfig").setup_handlers({ + function(server_name) + require("lspconfig")[server_name].setup{} + on_attach() + end, + ["rust_analyzer"] = function() + require('rust-tools-setup') + on_attach() + end, + ["sumneko_lua"] = function () + require('lspconfig').sumneko_lua.setup { + settings = { + Lua = { + diagnostics = { + globals = { "vim" } + } + } + } + } + on_attach() + end, +}) diff --git a/neovim/.config/nvim/lua/packages.lua b/neovim/.config/nvim/lua/packages.lua index 17ae3eb..682c6b0 100644 --- a/neovim/.config/nvim/lua/packages.lua +++ b/neovim/.config/nvim/lua/packages.lua @@ -26,33 +26,44 @@ return require('packer').startup(function(use) } use { { - "williamboman/nvim-lsp-installer", - config = function () - require("nvim-lsp-installer").setup { - ensure_installed = { - 'pyright', - 'bashls', - 'rust_analyzer', - 'sumneko_lua', - 'texlab', - }, - automatic_installation = false, + "williamboman/mason.nvim", + config = function() + require("mason").setup({ ui = { icons = { - server_installed = "✓", - server_pending = "➜", - server_uninstalled = "✗" + package_installed = "✓", + package_pending = "➜", + package_uninstalled = "✗" } } - } + }) + end + }, + { + "williamboman/mason-lspconfig.nvim", + after = "mason.nvim", + config = function() + require("mason-lspconfig").setup({ + ensure_installed = { + "sumneko_lua", + "rust_analyzer", + 'pyright', + 'bashls', + 'texlab' + }, + automatic_installation=true + }) end }, { "neovim/nvim-lspconfig", - after = "nvim-lsp-installer", + after = "mason-lspconfig.nvim", config = function() require('LSPconfig') end + }, + {'simrat39/rust-tools.nvim', + after = "nvim-lspconfig", } } @@ -289,11 +300,6 @@ return require('packer').startup(function(use) --language specific tools. - use{'simrat39/rust-tools.nvim', - config=function() - require('rust-tools-setup') - end - } if Packer_Bootstrap then require('packer').sync() diff --git a/neovim/.config/nvim/lua/rust-tools-setup.lua b/neovim/.config/nvim/lua/rust-tools-setup.lua index 6f243f3..1ec50ac 100644 --- a/neovim/.config/nvim/lua/rust-tools-setup.lua +++ b/neovim/.config/nvim/lua/rust-tools-setup.lua @@ -2,7 +2,7 @@ local nvim_lsp = require'lspconfig' local opts = { tools = { autoSetHints = true, - hover_with_actions = true, + RustHoverActions = true, -- how to execute terminal commands executor = require("rust-tools/executors").termopen,