mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-03 03:56:52 -04:00
fix(install): skip tier 4 parsers when installing and updating
This commit is contained in:
parent
9365cf8a97
commit
328ee3db54
6 changed files with 51 additions and 40 deletions
|
|
@ -27,8 +27,10 @@ function M.setup(user_data)
|
|||
end
|
||||
|
||||
if #config.ensure_install > 0 then
|
||||
local to_install = M.norm_languages(config.ensure_install, { ignored = true, installed = true })
|
||||
|
||||
local to_install = M.norm_languages(
|
||||
config.ensure_install,
|
||||
{ ignored = true, installed = true, unsupported = true }
|
||||
)
|
||||
if #to_install > 0 then
|
||||
require('nvim-treesitter.install').install(to_install, { force = true })
|
||||
end
|
||||
|
|
@ -103,7 +105,7 @@ end
|
|||
|
||||
---Normalize languages
|
||||
---@param languages? string[]|string
|
||||
---@param skip? { ignored: boolean, missing: boolean, installed: boolean, dependencies: boolean }
|
||||
---@param skip? { ignored: boolean, missing: boolean, unsupported: boolean, installed: boolean, dependencies: boolean }
|
||||
---@return string[]
|
||||
function M.norm_languages(languages, skip)
|
||||
if not languages then
|
||||
|
|
@ -164,6 +166,16 @@ function M.norm_languages(languages, skip)
|
|||
languages
|
||||
)
|
||||
|
||||
if skip and skip.unsupported then
|
||||
languages = vim.tbl_filter(
|
||||
--- @param v string
|
||||
function(v)
|
||||
return parsers[v].tier < 4
|
||||
end,
|
||||
languages
|
||||
)
|
||||
end
|
||||
|
||||
if not (skip and skip.dependencies) then
|
||||
for _, lang in pairs(languages) do
|
||||
if parsers[lang].requires then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue