fix: query_predicate - nth

This commit is contained in:
Munif Tanjim 2021-08-03 20:10:29 +06:00 committed by Santos Gallegos
parent 50a77bbc22
commit 35a8fe5a81

View file

@ -26,7 +26,7 @@ query.add_predicate("nth?", function(match, pattern, bufnr, pred)
end
local node = match[pred[2]]
local n = pred[3]
local n = tonumber(pred[3])
if node and node:parent() and node:parent():named_child_count() > n then
return node:parent():named_child(n) == node
end