mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-02 19:46:58 -04:00
Fix: avoid overwriting tables in insert_to_path
The following query will result in matches with only one node though it
requires two nodes to be a match.
```scheme
(function_definition
(comment) @function.inner.start
body: (block) @function.inner)
```
Why? First `insert_to_path` is called for `@function.inner.start` which
will result int the following table.
```lua
{ function = { inner = { start { node } } } }
```
`insert_to_path` will overwrite the result
```lua
{ function = { inner = { node } } }
```
Related #552
This commit is contained in:
parent
e5d8b6ade7
commit
994e42fac4
1 changed files with 2 additions and 2 deletions
|
|
@ -85,8 +85,8 @@ function M.iter_prepared_matches(query, qnode, bufnr, start_row, end_row)
|
|||
for id, node in pairs(match) do
|
||||
local name = query.captures[id] -- name of the capture in the query
|
||||
if name ~= nil then
|
||||
local path = split(name)
|
||||
insert_to_path(prepared_match, path, { node=node })
|
||||
local path = split(name..'.node')
|
||||
insert_to_path(prepared_match, path, node)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue