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