mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-14 09:20:04 -04:00
fix: filter languages through parser.configs
This commit is contained in:
parent
0ce8619a25
commit
d696bf5b2f
1 changed files with 6 additions and 2 deletions
|
|
@ -86,7 +86,7 @@ end
|
||||||
|
|
||||||
---Normalize languages
|
---Normalize languages
|
||||||
---@param languages? string[]|string
|
---@param languages? string[]|string
|
||||||
---@param skip? table
|
---@param skip? { ignored: boolean, missing: boolean, installed: boolean, dependencies: boolean }
|
||||||
---@return string[]
|
---@return string[]
|
||||||
function M.norm_languages(languages, skip)
|
function M.norm_languages(languages, skip)
|
||||||
if not languages then
|
if not languages then
|
||||||
|
|
@ -103,7 +103,6 @@ function M.norm_languages(languages, skip)
|
||||||
end
|
end
|
||||||
languages = parsers.get_available()
|
languages = parsers.get_available()
|
||||||
end
|
end
|
||||||
--TODO(clason): skip and warn on unavailable parser
|
|
||||||
|
|
||||||
-- keep local to avoid leaking parsers module
|
-- keep local to avoid leaking parsers module
|
||||||
local function expand_tiers(list)
|
local function expand_tiers(list)
|
||||||
|
|
@ -142,6 +141,11 @@ function M.norm_languages(languages, skip)
|
||||||
end, languages) --[[@as string[] ]]
|
end, languages) --[[@as string[] ]]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
languages = vim.iter.filter(function(v)
|
||||||
|
-- TODO(lewis6991): warn of any unknown parsers?
|
||||||
|
return parsers.configs[v] ~= nil
|
||||||
|
end, languages) --[[@as string[] ]]
|
||||||
|
|
||||||
if not (skip and skip.dependencies) then
|
if not (skip and skip.dependencies) then
|
||||||
for _, lang in pairs(languages) do
|
for _, lang in pairs(languages) do
|
||||||
if parsers.configs[lang].requires then
|
if parsers.configs[lang].requires then
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue