update nvim-lspinstall to nvim-lsp-installer

This commit is contained in:
juan 2021-12-01 21:21:16 +08:00
parent 3054e03fca
commit 0aafb8a2ab
Signed by: juan
GPG Key ID: 5C1E5093C74F1DC7
2 changed files with 18 additions and 18 deletions

View File

@ -33,9 +33,9 @@ return require('packer').startup(function(use)
}
-- lsp stuff
use {'neovim/nvim-lspconfig', event = "VimEnter"}
use {'neovim/nvim-lspconfig', event = "BufEnter"}
use {
'kabouzeid/nvim-lspinstall',
'williamboman/nvim-lsp-installer',
config = function() require "plugins.lspinstall" end,
after = 'nvim-lspconfig'
}
@ -57,7 +57,7 @@ return require('packer').startup(function(use)
use {
'ms-jpq/coq_nvim',
branch = 'coq',
after = 'nvim-lspinstall',
after = 'nvim-lsp-installer',
run = ':COQdeps',
config = function() require "plugins.coq" end
}
@ -134,7 +134,7 @@ return require('packer').startup(function(use)
use {
"Pocco81/TrueZen.nvim",
cmd = {'TZAtaraxis', 'TZFocus', 'TZMinimalist'},
config = function() require "plugins.truezen" end
config = function() require "plugins.truezen" end
}
use {
"lukas-reineke/indent-blankline.nvim",

View File

@ -1,17 +1,17 @@
local function setup_servers()
require'lspinstall'.setup()
local servers = require'lspinstall'.installed_servers()
for _, server in pairs(servers) do
require'lspconfig'[server].setup{}
end
end
local lsp_installer = require("nvim-lsp-installer")
setup_servers()
-- Register a handler that will be called for all installed servers.
-- Alternatively, you may also register handlers on specific server instances instead (see example below).
lsp_installer.on_server_ready(function(server)
local opts = {}
-- Automatically reload after `:LspInstall <server>` so we don't have to restart neovim
require'lspinstall'.post_install_hook = function ()
setup_servers() -- reload installed servers
vim.cmd("bufdo e") -- this triggers the FileType autocmd that starts the server
end
-- (optional) Customize the options passed to the server
-- if server.name == "tsserver" then
-- opts.root_dir = function() ... end
-- end
-- This setup() function is exactly the same as lspconfig's setup function.
-- Refer to https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md
server:setup(opts)
end)
vim.cmd(':LspStart')