refactor(nvim): remove nvim-lspinstall

Remove the kabouzeid/nvim-lspinstall plugin and configure the language
servers in init.lua.

I don't use all of the languages bundled with nvim-lspinstall, and the
ones that I use are already installed via Ansible in my
ubuntu-provisioning repository.

Fixes #20
This commit is contained in:
Oliver Davies 2021-10-13 08:57:19 +01:00
parent 403581e9f8
commit 28c5ae22f9
2 changed files with 30 additions and 20 deletions

View file

@ -15,30 +15,41 @@ configs.setup {
} }
-- LSP -- LSP
local function setup_servers() local has_lsp, lspconfig = pcall(require, "lspconfig")
require'lspinstall'.setup()
local servers = require'lspinstall'.installed_servers() local servers = {
for _, server in pairs(servers) do ansiblels = true,
require'lspconfig'[server].setup{} bashls = true,
cssls = true,
html = true,
intelephense = {
filetypes = { "install", "inc", "module", "php", "test", "theme" }
},
tsserver = {
filetypes = { "js", "jsx", "ts", "vue" }
},
yamlls = true,
}
local setup_server = function(server, config)
if not config then
return
end end
if type(config) ~= "table" then
config = {}
end
lspconfig[server].setup(config)
end end
setup_servers() for server, config in pairs(servers) do
setup_server(server, config)
-- Automatically reload after `:LspInstall <server>` so we don't have to restart neovim
require'lspinstall'.post_install_hook = function ()
setup_servers()
vim.cmd("bufdo e")
end end
--lspconfig.intelephense.setup{
--filetypes = { "install", "inc", "module", "php", "test", "theme" },
--}
--lspconfig.tsserver.setup{
--filetypes = { "js", "jsx", "ts", "vue" },
--}
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with( vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
vim.lsp.diagnostic.on_publish_diagnostics, { vim.lsp.diagnostic.on_publish_diagnostics, {
underline = true, underline = true,

View file

@ -33,7 +33,6 @@ Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
Plug 'hrsh7th/nvim-compe' Plug 'hrsh7th/nvim-compe'
" LSP " LSP
Plug 'kabouzeid/nvim-lspinstall'
Plug 'neovim/nvim-lspconfig' Plug 'neovim/nvim-lspconfig'
" Telescope " Telescope