mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-21 04:40:08 -04:00
Fix "nth?" predicate
This commit is contained in:
parent
362204f85c
commit
9f12ad1142
1 changed files with 3 additions and 3 deletions
|
|
@ -24,9 +24,9 @@ query.add_predicate("nth?", function(match, pattern, bufnr, pred)
|
||||||
if not valid_args("nth?", pred, 2, true) then return end
|
if not valid_args("nth?", pred, 2, true) then return end
|
||||||
|
|
||||||
local node = match[pred[2]]
|
local node = match[pred[2]]
|
||||||
local n = pred[3] - 1
|
local n = pred[3]
|
||||||
if node and node:parent() and node:named_child_count() > n then
|
if node and node:parent() and node:parent():named_child_count() > n then
|
||||||
return node:named_child(n) == node
|
return node:parent():named_child(n) == node
|
||||||
end
|
end
|
||||||
|
|
||||||
return false
|
return false
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue