summaryrefslogtreecommitdiffstatshomepage
path: root/test/functional/treesitter/testutil.lua
AgeCommit message (Collapse)AuthorFiles
2025-06-13feat(treesitter)!: apply `offset!` directive to all captures #34383Riley Bruins1
This commit changes the `offset!` directive so that instead of setting a `metadata.range` value for the entire pattern, it will set a `metadata.offset` value. This offset will be applied to the range only in `vim.treesitter.get_range()`, rather than at directive application time. This allows the offset to be applied to any and all nodes captured by the given pattern, and removes the requirement that `#offset!` be applied to only a single node. The downside of this change is that plugins which read from `metadata.range` may be thrown off course, but such plugins should prefer `vim.treesitter.get_range()` when retrieving ranges anyway. Note that `#trim!` still sets `metadata.range`, and `vim.treesitter.get_range()` still reads from `metadata.range`, if it exists.
2024-12-06test(treesitter): add a simple testutil fileRiley Bruins1
The util file, for now, just abstracts the common `run_query` function.