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

View File

@ -1,17 +1,17 @@
local function setup_servers() local lsp_installer = require("nvim-lsp-installer")
require'lspinstall'.setup()
local servers = require'lspinstall'.installed_servers()
for _, server in pairs(servers) do
require'lspconfig'[server].setup{}
end
end
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 -- (optional) Customize the options passed to the server
require'lspinstall'.post_install_hook = function () -- if server.name == "tsserver" then
setup_servers() -- reload installed servers -- opts.root_dir = function() ... end
vim.cmd("bufdo e") -- this triggers the FileType autocmd that starts the server -- 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')