Feat: set up lsp-installer

This commit is contained in:
Bertrand Benjamin 2022-02-14 06:57:25 +01:00
parent 07de246f77
commit 197eafd34d
2 changed files with 21 additions and 2 deletions

View File

@ -1,6 +1,22 @@
local lsp_installer = require("nvim-lsp-installer")
-- Register a handler that will be called for each installed server when it's ready (i.e. when installation is finished
-- or if the server is already installed).
lsp_installer.on_server_ready(function(server)
local opts = {}
-- (optional) Customize the options passed to the server
-- if server.name == "tsserver" then
-- opts.root_dir = function() ... end
-- end
-- This setup() function will take the provided server configuration and decorate it with the necessary properties
-- before passing it onwards to lspconfig.
-- Refer to https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md
server:setup(opts)
end)
local nvim_lsp = require('lspconfig') local nvim_lsp = require('lspconfig')
-- Use an on_attach function to only map the following keys -- Use an on_attach function to only map the following keys
-- after the language server attaches to the current buffer -- after the language server attaches to the current buffer
local on_attach = function(client, bufnr) local on_attach = function(client, bufnr)

View File

@ -2,6 +2,8 @@
vim.cmd [[packadd packer.nvim]] vim.cmd [[packadd packer.nvim]]
return require('packer').startup(function() return require('packer').startup(function()
-- Packer can manage itself
use 'wbthomason/packer.nvim'
use 'morhetz/gruvbox' use 'morhetz/gruvbox'
-- Status line -- Status line
@ -19,7 +21,8 @@ return require('packer').startup(function()
use { use {
'neovim/nvim-lspconfig', 'neovim/nvim-lspconfig',
requires = { requires = {
"hrsh7th/cmp-nvim-lsp" "hrsh7th/cmp-nvim-lsp",
'williamboman/nvim-lsp-installer',
} }
} }
use { use {