mirror of
https://github.com/neovim/neovim
synced 2025-07-16 01:01:49 +00:00
docs(treesitter): document TSNode:named_children()
This commit also gives an internal documentation description for `TSNode:__has_ancestor()`.
This commit is contained in:
committed by
Christian Clason
parent
175c09bd66
commit
fa85543e3b
@ -804,6 +804,12 @@ TSNode:named_child_count() *TSNode:named_child_count()*
|
||||
Return: ~
|
||||
(`integer`)
|
||||
|
||||
TSNode:named_children() *TSNode:named_children()*
|
||||
Returns a list of the node's named children.
|
||||
|
||||
Return: ~
|
||||
(`TSNode[]`)
|
||||
|
||||
*TSNode:named_descendant_for_range()*
|
||||
TSNode:named_descendant_for_range({start_row}, {start_col}, {end_row},
|
||||
{end_col})
|
||||
|
@ -10,8 +10,6 @@ error('Cannot require a meta file')
|
||||
|
||||
---@nodoc
|
||||
---@class TSNode: userdata
|
||||
---@field named_children fun(self: TSNode): TSNode[]
|
||||
---@field __has_ancestor fun(self: TSNode, node_types: string[]): boolean
|
||||
local TSNode = {} -- luacheck: no unused
|
||||
|
||||
--- Get the node's immediate parent.
|
||||
@ -62,6 +60,15 @@ function TSNode:child(index) end
|
||||
--- @return integer
|
||||
function TSNode:named_child_count() end
|
||||
|
||||
--- Returns a list of the node's named children.
|
||||
--- @return TSNode[]
|
||||
function TSNode:named_children() end
|
||||
|
||||
--- Check if the node has any of the given node types as its ancestor.
|
||||
--- @param node_types string[]
|
||||
--- @return boolean
|
||||
function TSNode:__has_ancestor(node_types) end
|
||||
|
||||
--- Get the node's named child at the given {index}, where zero represents the
|
||||
--- first named child.
|
||||
--- @param index integer
|
||||
|
Reference in New Issue
Block a user