Skip to main content

text

Function text 

Source
pub fn text<'a>(node: Node<'_>, source: &'a str) -> &'a str
Expand description

Returns the UTF-8 source text covered by a Tree-sitter node.

Tree-sitter byte ranges are expected to align with the original source text supplied to the parser. A panic here indicates the parser tree and source text no longer belong together.

let source_text = achitek_source::text(node, source);