mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-17 19:00:02 -04:00
ci: relax check for valid captures (only check prefixes)
This commit is contained in:
parent
c466ffd860
commit
9bfaf62e42
1 changed files with 12 additions and 1 deletions
|
|
@ -35,6 +35,15 @@ local function extract_captures()
|
||||||
return captures
|
return captures
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function list_any(list, predicate)
|
||||||
|
for _, v in pairs(list) do
|
||||||
|
if predicate(v) then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
local function do_check()
|
local function do_check()
|
||||||
local timings = {}
|
local timings = {}
|
||||||
local parsers = require("nvim-treesitter.info").installed_parsers()
|
local parsers = require("nvim-treesitter.info").installed_parsers()
|
||||||
|
|
@ -63,7 +72,9 @@ local function do_check()
|
||||||
for _, capture in ipairs(query.captures) do
|
for _, capture in ipairs(query.captures) do
|
||||||
local is_valid = (
|
local is_valid = (
|
||||||
vim.startswith(capture, "_") -- Helpers.
|
vim.startswith(capture, "_") -- Helpers.
|
||||||
or vim.tbl_contains(captures[query_type], capture)
|
or list_any(captures[query_type], function(documented_capture)
|
||||||
|
return vim.startswith(documented_capture, capture)
|
||||||
|
end)
|
||||||
)
|
)
|
||||||
if not is_valid then
|
if not is_valid then
|
||||||
local error = string.format("(x) Invalid capture @%s in %s for %s.", capture, query_type, lang)
|
local error = string.format("(x) Invalid capture @%s in %s for %s.", capture, query_type, lang)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue