doc(treesitter): add doc for child_containing_descendant()

This commit is contained in:
vanaigr 2024-04-25 18:58:39 -05:00
parent f642475767
commit e22707f249
2 changed files with 6 additions and 0 deletions

View File

@ -65,6 +65,8 @@ An instance `TSNode` of a treesitter node supports the following methods.
TSNode:parent() *TSNode:parent()*
Get the node's immediate parent.
Prefer |TSNode:child_containing_descendant()|
for iterating over the node's ancestors.
TSNode:next_sibling() *TSNode:next_sibling()*
Get the node's next sibling.
@ -101,6 +103,9 @@ TSNode:named_child({index}) *TSNode:named_child()*
Get the node's named child at the given {index}, where zero represents the
first named child.
TSNode:child_containing_descendant({descendant}) *TSNode:child_containing_descendant()*
Get the node's child that contains {descendant}.
TSNode:start() *TSNode:start()*
Get the node's start position. Return three values: the row, column and
total byte count (all zero-based).

View File

@ -20,6 +20,7 @@ error('Cannot require a meta file')
---@field descendant_for_range fun(self: TSNode, start_row: integer, start_col: integer, end_row: integer, end_col: integer): TSNode?
---@field named_descendant_for_range fun(self: TSNode, start_row: integer, start_col: integer, end_row: integer, end_col: integer): TSNode?
---@field parent fun(self: TSNode): TSNode?
---@field child_containing_descendant fun(self: TSNode, descendant: TSNode): TSNode?
---@field next_sibling fun(self: TSNode): TSNode?
---@field prev_sibling fun(self: TSNode): TSNode?
---@field next_named_sibling fun(self: TSNode): TSNode?