mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-06-28 03:30:12 +02:00
fix: cleanup unnecessary treesitter langs and mason lsp servers
This commit is contained in:
parent
368c060b45
commit
f8268faa7c
14 changed files with 32 additions and 86 deletions
|
@ -5,14 +5,6 @@ return {
|
||||||
root = { "ansible.cfg", ".ansible-lint" },
|
root = { "ansible.cfg", ".ansible-lint" },
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
{
|
|
||||||
"nvim-treesitter/nvim-treesitter",
|
|
||||||
opts = function(_, opts)
|
|
||||||
if type(opts.ensure_installed) == "table" then
|
|
||||||
vim.list_extend(opts.ensure_installed, { "yaml" })
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"williamboman/mason.nvim",
|
"williamboman/mason.nvim",
|
||||||
opts = function(_, opts)
|
opts = function(_, opts)
|
||||||
|
|
|
@ -18,7 +18,7 @@ return {
|
||||||
"nvim-treesitter/nvim-treesitter",
|
"nvim-treesitter/nvim-treesitter",
|
||||||
opts = function(_, opts)
|
opts = function(_, opts)
|
||||||
if type(opts.ensure_installed) == "table" then
|
if type(opts.ensure_installed) == "table" then
|
||||||
vim.list_extend(opts.ensure_installed, { "c", "cpp" })
|
vim.list_extend(opts.ensure_installed, { "cpp" })
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
|
@ -15,14 +15,6 @@ return {
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"williamboman/mason.nvim",
|
|
||||||
opts = function(_, opts)
|
|
||||||
vim.list_extend(opts.ensure_installed, {
|
|
||||||
"elixir-ls",
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"nvim-neotest/neotest",
|
"nvim-neotest/neotest",
|
||||||
optional = true,
|
optional = true,
|
||||||
|
|
|
@ -26,12 +26,4 @@ return {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"williamboman/mason.nvim",
|
|
||||||
opts = function(_, opts)
|
|
||||||
vim.list_extend(opts.ensure_installed, {
|
|
||||||
"helm-ls",
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ return {
|
||||||
"nvim-treesitter/nvim-treesitter",
|
"nvim-treesitter/nvim-treesitter",
|
||||||
opts = function(_, opts)
|
opts = function(_, opts)
|
||||||
if type(opts.ensure_installed) == "table" then
|
if type(opts.ensure_installed) == "table" then
|
||||||
vim.list_extend(opts.ensure_installed, { "json", "json5", "jsonc" })
|
vim.list_extend(opts.ensure_installed, { "json5" })
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
|
@ -15,19 +15,11 @@ return {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"nvim-treesitter/nvim-treesitter",
|
|
||||||
opts = function(_, opts)
|
|
||||||
if type(opts.ensure_installed) == "table" then
|
|
||||||
vim.list_extend(opts.ensure_installed, { "markdown", "markdown_inline" })
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"williamboman/mason.nvim",
|
"williamboman/mason.nvim",
|
||||||
opts = function(_, opts)
|
opts = function(_, opts)
|
||||||
opts.ensure_installed = opts.ensure_installed or {}
|
opts.ensure_installed = opts.ensure_installed or {}
|
||||||
vim.list_extend(opts.ensure_installed, { "markdownlint", "marksman" })
|
vim.list_extend(opts.ensure_installed, { "markdownlint" })
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -26,7 +26,7 @@ return {
|
||||||
"nvim-treesitter/nvim-treesitter",
|
"nvim-treesitter/nvim-treesitter",
|
||||||
opts = function(_, opts)
|
opts = function(_, opts)
|
||||||
if type(opts.ensure_installed) == "table" then
|
if type(opts.ensure_installed) == "table" then
|
||||||
vim.list_extend(opts.ensure_installed, { "ninja", "python", "rst", "toml" })
|
vim.list_extend(opts.ensure_installed, { "ninja", "rst" })
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
|
@ -61,7 +61,7 @@ return {
|
||||||
"nvim-treesitter/nvim-treesitter",
|
"nvim-treesitter/nvim-treesitter",
|
||||||
opts = function(_, opts)
|
opts = function(_, opts)
|
||||||
if type(opts.ensure_installed) == "table" then
|
if type(opts.ensure_installed) == "table" then
|
||||||
vim.list_extend(opts.ensure_installed, { "markdown", "markdown_inline", "r", "rnoweb" })
|
vim.list_extend(opts.ensure_installed, { "r", "rnoweb" })
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
|
@ -13,14 +13,6 @@ return {
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"williamboman/mason.nvim",
|
|
||||||
opts = function(_, opts)
|
|
||||||
vim.list_extend(opts.ensure_installed, {
|
|
||||||
"solargraph",
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"neovim/nvim-lspconfig",
|
"neovim/nvim-lspconfig",
|
||||||
opts = {
|
opts = {
|
||||||
|
|
|
@ -32,7 +32,7 @@ return {
|
||||||
"nvim-treesitter/nvim-treesitter",
|
"nvim-treesitter/nvim-treesitter",
|
||||||
opts = function(_, opts)
|
opts = function(_, opts)
|
||||||
opts.ensure_installed = opts.ensure_installed or {}
|
opts.ensure_installed = opts.ensure_installed or {}
|
||||||
vim.list_extend(opts.ensure_installed, { "ron", "rust", "toml" })
|
vim.list_extend(opts.ensure_installed, { "ron", "rust" })
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ return {
|
||||||
{
|
{
|
||||||
"nvim-treesitter/nvim-treesitter",
|
"nvim-treesitter/nvim-treesitter",
|
||||||
opts = function(_, opts)
|
opts = function(_, opts)
|
||||||
|
opts.highlight = opts.highlight or {}
|
||||||
if type(opts.ensure_installed) == "table" then
|
if type(opts.ensure_installed) == "table" then
|
||||||
vim.list_extend(opts.ensure_installed, { "bibtex" })
|
vim.list_extend(opts.ensure_installed, { "bibtex" })
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,27 +5,10 @@ return {
|
||||||
root = "*.toml",
|
root = "*.toml",
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
{
|
|
||||||
"nvim-treesitter/nvim-treesitter",
|
|
||||||
opts = function(_, opts)
|
|
||||||
if type(opts.ensure_installed) == "table" then
|
|
||||||
vim.list_extend(opts.ensure_installed, { "toml" })
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"williamboman/mason.nvim",
|
|
||||||
opts = function(_, opts)
|
|
||||||
opts.ensure_installed = opts.ensure_installed or {}
|
|
||||||
vim.list_extend(opts.ensure_installed, { "taplo" })
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"neovim/nvim-lspconfig",
|
"neovim/nvim-lspconfig",
|
||||||
opts = {
|
opts = {
|
||||||
servers = {
|
servers = {
|
||||||
taplo = {},
|
taplo = {},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,16 +5,6 @@ return {
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
|
|
||||||
-- add yaml specific modules to treesitter
|
|
||||||
{
|
|
||||||
"nvim-treesitter/nvim-treesitter",
|
|
||||||
opts = function(_, opts)
|
|
||||||
if type(opts.ensure_installed) == "table" then
|
|
||||||
vim.list_extend(opts.ensure_installed, { "yaml" })
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
|
|
||||||
-- yaml schema support
|
-- yaml schema support
|
||||||
{
|
{
|
||||||
"b0o/SchemaStore.nvim",
|
"b0o/SchemaStore.nvim",
|
||||||
|
|
|
@ -19,7 +19,8 @@ describe("Extra", function()
|
||||||
return name:match("%.lua$")
|
return name:match("%.lua$")
|
||||||
end, { limit = math.huge, type = "file", path = "lua/lazyvim/plugins/extras" })
|
end, { limit = math.huge, type = "file", path = "lua/lazyvim/plugins/extras" })
|
||||||
)
|
)
|
||||||
local servers = require("mason-lspconfig.mappings.server").package_to_lspconfig
|
local lsp_to_pkg = require("mason-lspconfig.mappings.server").lspconfig_to_package
|
||||||
|
local pkg_to_lsp = require("mason-lspconfig.mappings.server").package_to_lspconfig
|
||||||
|
|
||||||
local tsspec = Plugin.Spec.new({
|
local tsspec = Plugin.Spec.new({
|
||||||
import = "lazyvim.plugins.treesitter",
|
import = "lazyvim.plugins.treesitter",
|
||||||
|
@ -43,16 +44,27 @@ describe("Extra", function()
|
||||||
|
|
||||||
if extra.modname:find("%.lang%.") then
|
if extra.modname:find("%.lang%.") then
|
||||||
assert(mod.recommended, "`recommended` not set for " .. extra.modname)
|
assert(mod.recommended, "`recommended` not set for " .. extra.modname)
|
||||||
|
local lspconfig = spec.plugins["nvim-lspconfig"]
|
||||||
|
|
||||||
|
if lspconfig then
|
||||||
|
local lspconfig_opts = Plugin.values(lspconfig, "opts", false)
|
||||||
local mason = spec.plugins["mason.nvim"]
|
local mason = spec.plugins["mason.nvim"]
|
||||||
local opts = Plugin.values(mason, "opts", false)
|
local mason_opts = Plugin.values(mason, "opts", false)
|
||||||
for _, v in ipairs(opts.ensure_installed) do
|
|
||||||
|
for lsp in pairs(lspconfig_opts.servers or {}) do
|
||||||
|
local lsp_pkg = pkg_to_lsp[lsp]
|
||||||
assert(
|
assert(
|
||||||
not servers[v],
|
not (lsp_pkg and vim.tbl_contains(mason_opts.ensure_installed, lsp_pkg)),
|
||||||
"LSP server " .. v .. " is installed automatically. Please remove from the mason.nvim spec"
|
"LSP server "
|
||||||
|
.. lsp
|
||||||
|
.. " with pkg "
|
||||||
|
.. (lsp_pkg or "foo")
|
||||||
|
.. " is installed automatically. Please remove from the mason.nvim spec"
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
local ts = spec.plugins["nvim-treesitter"]
|
local ts = spec.plugins["nvim-treesitter"]
|
||||||
opts = Plugin.values(mason, "opts", false)
|
local opts = Plugin.values(ts, "opts", false)
|
||||||
for _, v in ipairs(opts.ensure_installed) do
|
for _, v in ipairs(opts.ensure_installed) do
|
||||||
assert(
|
assert(
|
||||||
not vim.tbl_contains(tsensure, v),
|
not vim.tbl_contains(tsensure, v),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue