transitioned from nvim-lsp-installer to mason and mason-lspconfig.
This commit is contained in:
		
							parent
							
								
									f197e20c61
								
							
						
					
					
						commit
						ed05b99be0
					
				
					 3 changed files with 50 additions and 25 deletions
				
			
		| 
						 | 
					@ -1,5 +1,3 @@
 | 
				
			||||||
local lsp_installer = require("nvim-lsp-installer")
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
local opts = {}
 | 
					local opts = {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
local on_attach = function()
 | 
					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('', ';lp', '<cmd>lua vim.diagnostic.goto_next()<CR>', opts)
 | 
				
			||||||
	set_keymap('', ';lm', '<cmd>lua vim.lsp.buf.formatting()<CR>', opts)
 | 
						set_keymap('', ';lm', '<cmd>lua vim.lsp.buf.formatting()<CR>', opts)
 | 
				
			||||||
end
 | 
					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,
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -26,33 +26,44 @@ return require('packer').startup(function(use)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	use {
 | 
						use {
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			"williamboman/nvim-lsp-installer",
 | 
								"williamboman/mason.nvim",
 | 
				
			||||||
			config = function ()
 | 
								config = function()
 | 
				
			||||||
				require("nvim-lsp-installer").setup {
 | 
									require("mason").setup({
 | 
				
			||||||
					ensure_installed = {
 | 
					 | 
				
			||||||
						'pyright',
 | 
					 | 
				
			||||||
						'bashls',
 | 
					 | 
				
			||||||
						'rust_analyzer',
 | 
					 | 
				
			||||||
						'sumneko_lua',
 | 
					 | 
				
			||||||
						'texlab',
 | 
					 | 
				
			||||||
					},
 | 
					 | 
				
			||||||
					automatic_installation = false,
 | 
					 | 
				
			||||||
					ui = {
 | 
										ui = {
 | 
				
			||||||
						icons = {
 | 
											icons = {
 | 
				
			||||||
							server_installed = "✓",
 | 
												package_installed = "✓",
 | 
				
			||||||
							server_pending = "➜",
 | 
												package_pending = "➜",
 | 
				
			||||||
							server_uninstalled = "✗"
 | 
												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
 | 
								end
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			"neovim/nvim-lspconfig",
 | 
								"neovim/nvim-lspconfig",
 | 
				
			||||||
			after = "nvim-lsp-installer",
 | 
								after = "mason-lspconfig.nvim",
 | 
				
			||||||
			config = function()
 | 
								config = function()
 | 
				
			||||||
				require('LSPconfig')
 | 
									require('LSPconfig')
 | 
				
			||||||
			end
 | 
								end
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
							{'simrat39/rust-tools.nvim',
 | 
				
			||||||
 | 
								after = "nvim-lspconfig",
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -289,11 +300,6 @@ return require('packer').startup(function(use)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	--language specific tools.
 | 
						--language specific tools.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	use{'simrat39/rust-tools.nvim',
 | 
					 | 
				
			||||||
		config=function()
 | 
					 | 
				
			||||||
			require('rust-tools-setup')
 | 
					 | 
				
			||||||
		end
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if Packer_Bootstrap then
 | 
						if Packer_Bootstrap then
 | 
				
			||||||
		require('packer').sync()
 | 
							require('packer').sync()
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,7 +2,7 @@ local nvim_lsp = require'lspconfig'
 | 
				
			||||||
local opts = {
 | 
					local opts = {
 | 
				
			||||||
	tools = {
 | 
						tools = {
 | 
				
			||||||
	autoSetHints = true,
 | 
						autoSetHints = true,
 | 
				
			||||||
	hover_with_actions = true,
 | 
						RustHoverActions = true,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	-- how to execute terminal commands
 | 
						-- how to execute terminal commands
 | 
				
			||||||
	executor = require("rust-tools/executors").termopen,
 | 
						executor = require("rust-tools/executors").termopen,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue