tree_sitter::ffi

Function ts_query_cursor_set_max_start_depth

Source
pub unsafe extern "C" fn ts_query_cursor_set_max_start_depth(
    self_: *mut TSQueryCursor,
    max_start_depth: u32,
)
Expand description

Set the maximum start depth for a query cursor.

This prevents cursors from exploring children nodes at a certain depth. Note if a pattern includes many children, then they will still be checked.

The zero max start depth value can be used as a special behavior and it helps to destructure a subtree by staying on a node and using captures for interested parts. Note that the zero max start depth only limit a search depth for a pattern’s root node but other nodes that are parts of the pattern may be searched at any depth what defined by the pattern structure.

Set to UINT32_MAX to remove the maximum start depth.