mirror of
https://github.com/neovim/neovim.git
synced 2025-10-26 04:17:01 +00:00
feat(treesitter)!: default to correct behavior for quantified captures (#30193)
For context, see https://github.com/neovim/neovim/pull/24738. Before that PR, Nvim did not correctly handle captures with quantifiers. That PR made the correct behavior opt-in to minimize breaking changes, with the intention that the correct behavior would eventually become the default. Users can still opt-in to the old (incorrect) behavior for now, but this option will eventually be removed completely. BREAKING CHANGE: Any plugin which uses `Query:iter_matches()` must update their call sites to expect an array of nodes in the `match` table, rather than a single node.
This commit is contained in:
@@ -196,7 +196,7 @@ function M._get_urls()
|
||||
local query = vim.treesitter.query.get(lang, 'highlights')
|
||||
if query then
|
||||
local tree = assert(ltree:tree_for_range(range))
|
||||
for _, match, metadata in query:iter_matches(tree:root(), bufnr, row, row + 1, { all = true }) do
|
||||
for _, match, metadata in query:iter_matches(tree:root(), bufnr, row, row + 1) do
|
||||
for id, nodes in pairs(match) do
|
||||
for _, node in ipairs(nodes) do
|
||||
if vim.treesitter.node_contains(node, range) then
|
||||
|
||||
Reference in New Issue
Block a user