diff options
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/check-queries.lua | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/scripts/check-queries.lua b/scripts/check-queries.lua index 6da143c04..c816c19b1 100755 --- a/scripts/check-queries.lua +++ b/scripts/check-queries.lua @@ -21,7 +21,7 @@ local function extract_captures() end local function do_check() - local parsers = require 'nvim-treesitter.parsers'.available_parsers() + local parsers = require 'nvim-treesitter.info'.installed_parsers() local queries = require 'nvim-treesitter.query' local query_types = queries.built_in_query_groups @@ -29,28 +29,24 @@ local function do_check() local last_error for _, lang in pairs(parsers) do - if parsers.has_parser(lang) then - for _, query_type in pairs(query_types) do - print('Checking '..lang..' '..query_type) - local ok, query = pcall(queries.get_query,lang, query_type) - if not ok then - vim.api.nvim_err_writeln(query) - last_error = query - else - if query then - for _, capture in ipairs(query.captures) do - if not vim.startswith(capture, "_") -- We ignore things like _helper - and captures[query_type] - and not capture:find("^[A-Z]") -- Highlight groups - and not vim.tbl_contains(captures[query_type], capture) then - error(string.format("Invalid capture @%s in %s for %s.", capture, query_type, lang)) - end + for _, query_type in pairs(query_types) do + print('Checking '..lang..' '..query_type) + local ok, query = pcall(queries.get_query,lang, query_type) + if not ok then + vim.api.nvim_err_writeln(query) + last_error = query + else + if query then + for _, capture in ipairs(query.captures) do + if not vim.startswith(capture, "_") -- We ignore things like _helper + and captures[query_type] + and not capture:find("^[A-Z]") -- Highlight groups + and not vim.tbl_contains(captures[query_type], capture) then + error(string.format("Invalid capture @%s in %s for %s.", capture, query_type, lang)) end end end end - else - print("No parser for "..lang.." installed! Skipping...") end end if last_error then |
