aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
authorStephan Seitz <stephan.seitz@fau.de>2020-11-16 21:22:52 +0100
committerThomas Vigouroux <tomvig38@gmail.com>2021-01-20 10:39:21 +0100
commit9f12ad1142815c0d9078fe54b382ca5650ba8756 (patch)
treeca60ff23979ed1f48953c1401b4162faf6e4545f /lua
parentlua: Add more indent nodes (diff)
downloadnvim-treesitter-9f12ad1142815c0d9078fe54b382ca5650ba8756.tar
nvim-treesitter-9f12ad1142815c0d9078fe54b382ca5650ba8756.tar.gz
nvim-treesitter-9f12ad1142815c0d9078fe54b382ca5650ba8756.tar.bz2
nvim-treesitter-9f12ad1142815c0d9078fe54b382ca5650ba8756.tar.lz
nvim-treesitter-9f12ad1142815c0d9078fe54b382ca5650ba8756.tar.xz
nvim-treesitter-9f12ad1142815c0d9078fe54b382ca5650ba8756.tar.zst
nvim-treesitter-9f12ad1142815c0d9078fe54b382ca5650ba8756.zip
Fix "nth?" predicate
Diffstat (limited to 'lua')
-rw-r--r--lua/nvim-treesitter/query_predicates.lua6
1 files changed, 3 insertions, 3 deletions
diff --git a/lua/nvim-treesitter/query_predicates.lua b/lua/nvim-treesitter/query_predicates.lua
index d5aacb1ec..a41ad287b 100644
--- a/lua/nvim-treesitter/query_predicates.lua
+++ b/lua/nvim-treesitter/query_predicates.lua
@@ -24,9 +24,9 @@ query.add_predicate("nth?", function(match, pattern, bufnr, pred)
if not valid_args("nth?", pred, 2, true) then return end
local node = match[pred[2]]
- local n = pred[3] - 1
- if node and node:parent() and node:named_child_count() > n then
- return node:named_child(n) == node
+ local n = pred[3]
+ if node and node:parent() and node:parent():named_child_count() > n then
+ return node:parent():named_child(n) == node
end
return false