diff options
| author | Christian Clason <c.clason@uni-graz.at> | 2025-04-29 19:40:18 +0200 |
|---|---|---|
| committer | Christian Clason <c.clason@uni-graz.at> | 2025-05-12 18:43:41 +0200 |
| commit | 53dccb3a77da54a4e428275e8b44dbff77e0d47d (patch) | |
| tree | 921e2ba83265f6cba3e828b3100692255e33f359 /scripts/check-queries.lua | |
| parent | refactor(locals): fix type annotations and warnings (diff) | |
| download | nvim-treesitter-53dccb3a77da54a4e428275e8b44dbff77e0d47d.tar nvim-treesitter-53dccb3a77da54a4e428275e8b44dbff77e0d47d.tar.gz nvim-treesitter-53dccb3a77da54a4e428275e8b44dbff77e0d47d.tar.bz2 nvim-treesitter-53dccb3a77da54a4e428275e8b44dbff77e0d47d.tar.lz nvim-treesitter-53dccb3a77da54a4e428275e8b44dbff77e0d47d.tar.xz nvim-treesitter-53dccb3a77da54a4e428275e8b44dbff77e0d47d.tar.zst nvim-treesitter-53dccb3a77da54a4e428275e8b44dbff77e0d47d.zip | |
feat(tests)!: new infrastructure based on makefile
Problem: Not easy to run all checks and tests locally. Redundant CI
workflows.
Solution: Separate CI into two workflows:
* lint: Lua files (stylua, luals), query files (valid captures,
predicates, directives using tsqueryls), docs
(SUPPORTED_LANGUAGES.md) -- does not need parser installation
* tests: parsers (ABI compatibility), query files (tsqueryls on
Linux/macOS; nvim on Windows), highlight and indent tests (separated
for better readability) -- needs parser installation (but only once)
Switch to https://github.com/nvim-treesitter/highlight-assertions fork
with ABI 15 support.
Run all tests (on Linux and macOS) through `make` (`formatlua`,
`checklua`, `lintquery`, `formatquery`, `checkquery`, `docs`, `tests`),
which downloads and caches all necessary dependencies.
Remove `update-readme` workflow (replaced by lint job on PRs).
Diffstat (limited to 'scripts/check-queries.lua')
| -rwxr-xr-x | scripts/check-queries.lua | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/scripts/check-queries.lua b/scripts/check-queries.lua index 66b947914..0a684f5eb 100755 --- a/scripts/check-queries.lua +++ b/scripts/check-queries.lua @@ -6,29 +6,6 @@ local configs = require('nvim-treesitter.parsers') local parsers = #_G.arg > 0 and { unpack(_G.arg) } or require('nvim-treesitter.config').installed_parsers() --- Extract captures from documentation for validation -local captures = {} ---@type table[] -do - local current_query ---@type string - - for line in io.lines('CONTRIBUTING.md') do - if vim.startswith(line, '### ') then - current_query = line:sub(5):lower() ---@type string - elseif vim.startswith(line, '@') and current_query then - if not captures[current_query] then - captures[current_query] = {} - end - - table.insert(captures[current_query], vim.split(line:sub(2), ' ')[1]) - end - end - - -- Complete captures for injections. - for lang, _ in pairs(configs) do - table.insert(captures['injections'], lang) - end -end - -- Check queries for each installed parser in parsers local errors = {} ---@type string[] local timings = {} ---@type { duration: number, lang: string, query_type: string }[] @@ -46,19 +23,6 @@ do print(string.format('Checking %s %s (%.02fms)', lang, query_type, duration * 1e-6)) if not ok then errors[#errors + 1] = string.format('%s (%s): %s', lang, query_type, query) - else - if query then - for _, capture in ipairs(query.captures) do - local is_valid = ( - vim.startswith(capture, '_') -- Helpers. - or vim.list_contains(captures[query_type], capture) - ) - if not is_valid then - errors[#errors + 1] = - string.format('%s (%s): invalid capture "@%s"', lang, query_type, capture) - end - end - end end end end |
