neovim: move to mason for installing lsp clients
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
local lsp_installer = require("nvim-lsp-installer")
|
local mason = require("mason")
|
||||||
|
local lsp_installer = require("mason-lspconfig")
|
||||||
local lspconfig = require("lspconfig")
|
local lspconfig = require("lspconfig")
|
||||||
local null_ls = require("null-ls")
|
local null_ls = require("null-ls")
|
||||||
local util = require("lspconfig").util
|
local util = require("lspconfig").util
|
||||||
@@ -7,6 +8,8 @@ local u = require("daniil.utils")
|
|||||||
local formatting = null_ls.builtins.formatting
|
local formatting = null_ls.builtins.formatting
|
||||||
local diagnostics = null_ls.builtins.diagnostics
|
local diagnostics = null_ls.builtins.diagnostics
|
||||||
|
|
||||||
|
mason.setup()
|
||||||
|
|
||||||
lsp_installer.setup({
|
lsp_installer.setup({
|
||||||
ensure_installed = {
|
ensure_installed = {
|
||||||
"bashls",
|
"bashls",
|
||||||
@@ -90,11 +93,11 @@ for _, server in ipairs(servers) do
|
|||||||
root_dir = util.root_pattern(".git"),
|
root_dir = util.root_pattern(".git"),
|
||||||
}
|
}
|
||||||
|
|
||||||
if server.name == "emmet_ls" then
|
if server == "emmet_ls" then
|
||||||
opts.filetypes = { "html", "css", "scss", "javascripreact", "typescriptreact" }
|
opts.filetypes = { "html", "css", "scss", "javascripreact", "typescriptreact" }
|
||||||
end
|
end
|
||||||
|
|
||||||
if server.name == "sumneko_lua" then
|
if server == "sumneko_lua" then
|
||||||
local luadev = require("lua-dev").setup({
|
local luadev = require("lua-dev").setup({
|
||||||
lspconfig = {
|
lspconfig = {
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
@@ -105,7 +108,7 @@ for _, server in ipairs(servers) do
|
|||||||
opts = luadev
|
opts = luadev
|
||||||
end
|
end
|
||||||
|
|
||||||
if server.name == "jsonls" then
|
if server == "jsonls" then
|
||||||
opts.filetypes = { "json", "jsonc" }
|
opts.filetypes = { "json", "jsonc" }
|
||||||
opts.settings = {
|
opts.settings = {
|
||||||
json = {
|
json = {
|
||||||
@@ -140,7 +143,7 @@ for _, server in ipairs(servers) do
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
if server.name == "tsserver" then
|
if server == "tsserver" then
|
||||||
opts.settings = {
|
opts.settings = {
|
||||||
tsserver = {
|
tsserver = {
|
||||||
experimental = {
|
experimental = {
|
||||||
@@ -160,11 +163,11 @@ for _, server in ipairs(servers) do
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
if server.name == "denols" then
|
if server == "tailwindcss" then
|
||||||
opts.root_dir = util.root_pattern("deno.json", "deps.ts")
|
-- TODO: somehow need to help tailwindcss lsp find its config starting from .git
|
||||||
end
|
end
|
||||||
|
|
||||||
lspconfig[server.name].setup(opts)
|
lspconfig[server].setup(opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
|
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ require("packer").startup(function(use)
|
|||||||
|
|
||||||
-- LSP stuff
|
-- LSP stuff
|
||||||
use({ "neovim/nvim-lspconfig" })
|
use({ "neovim/nvim-lspconfig" })
|
||||||
use({ "williamboman/nvim-lsp-installer" })
|
use({ "williamboman/mason.nvim", "williamboman/mason-lspconfig.nvim" })
|
||||||
use({ "jose-elias-alvarez/null-ls.nvim" })
|
use({ "jose-elias-alvarez/null-ls.nvim" })
|
||||||
use({ "ray-x/lsp_signature.nvim" })
|
use({ "ray-x/lsp_signature.nvim" })
|
||||||
use({
|
use({
|
||||||
@@ -116,6 +116,7 @@ require("packer").startup(function(use)
|
|||||||
"rcarriga/nvim-notify",
|
"rcarriga/nvim-notify",
|
||||||
config = function()
|
config = function()
|
||||||
require("notify").setup({})
|
require("notify").setup({})
|
||||||
|
vim.notify = require("notify")
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user