transitioned from nvim-lsp-installer to mason and mason-lspconfig.

This commit is contained in:
Gabe Venberg 2022-08-19 10:24:29 -05:00
parent f197e20c61
commit ed05b99be0
3 changed files with 50 additions and 25 deletions

View file

@ -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', '<cmd>lua vim.diagnostic.goto_next()<CR>', opts)
set_keymap('', ';lm', '<cmd>lua vim.lsp.buf.formatting()<CR>', 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,
})

View file

@ -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()

View file

@ -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,