feat(nvim): migrate from lsp-installer to mason and mason-lspconfig

This commit is contained in:
Stefan Imhoff
2022-08-10 13:53:21 +02:00
parent fa31dc836c
commit 7f84da2ae2
3 changed files with 27 additions and 16 deletions

View File

@@ -1,10 +1,10 @@
local status_ok, _ = pcall(require, 'lspconfig')
local status_ok, _ = pcall(require, "lspconfig")
if not status_ok then
return
return
end
require('kogakure.lsp.configs')
require('kogakure.lsp.handlers').setup()
require('kogakure.lsp.null-ls')
require('kogakure.lsp.trouble')
require('kogakure.lsp.lightbulb')
require("kogakure.lsp.mason")
require("kogakure.lsp.handlers").setup()
require("kogakure.lsp.null-ls")
require("kogakure.lsp.trouble")
require("kogakure.lsp.lightbulb")

View File

@@ -1,9 +1,18 @@
local status_ok, lsp_installer = pcall(require, "nvim-lsp-installer")
if not status_ok then
local mason_status_ok, mason = pcall(require, "mason")
local lspconfig_status_ok, lspconfig = pcall(require, "lspconfig")
local mason_lsp_config_status_ok, mason_lspconfig = pcall(require, "mason-lspconfig")
if not mason_status_ok then
return
end
local lspconfig = require("lspconfig")
if not lspconfig_status_ok then
return
end
if not mason_lsp_config_status_ok then
return
end
local servers = {
"cssls",
@@ -19,25 +28,26 @@ local servers = {
"stylelint_lsp",
"sumneko_lua",
"svelte",
"tailwindcss",
"theme_check",
"tsserver",
"vuels",
-- "remark_ls",
}
lsp_installer.settings({
mason.setup({
ui = {
icons = {
server_installed = "",
server_pending = "",
server_uninstalled = "",
package_installed = "",
package_pending = "",
package_uninstalled = "",
},
},
max_concurrent_installers = 4,
})
lsp_installer.setup({
mason_lspconfig.setup({
ensure_installed = servers,
})

View File

@@ -70,7 +70,8 @@ return packer.startup(function(use)
-- LSP
use("neovim/nvim-lspconfig") -- Enable LSP
use("williamboman/nvim-lsp-installer") -- Simple to use language server installer
use("williamboman/mason.nvim") -- Manage LSP servers, DAP servers, linters, and formatters
use("williamboman/mason-lspconfig.nvim") -- Bridge betwen Mason and lspconfig
use("jose-elias-alvarez/null-ls.nvim") -- Inject LSP diagnostics, code actions, and more
use("folke/trouble.nvim") -- Diagnostics
use("creativenull/diagnosticls-configs-nvim") -- Collection of linters and formatters