MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / node_text

Method node_text

atomic-semantic/src/parsers/rust.rs:489–497  ·  view source on GitHub ↗

Get the text content of a node.

(&self, node: &Node, source: &str)

Source from the content-addressed store, hash-verified

487
488 /// Get the text content of a node.
489 fn node_text(&self, node: &Node, source: &str) -> String {
490 let start = node.start_byte();
491 let end = node.end_byte();
492 if end <= source.len() {
493 source[start..end].to_string()
494 } else {
495 String::new()
496 }
497 }
498
499 /// Get the first line of a node's text (for signatures).
500 fn first_line(&self, node: &Node, source: &str) -> Option<String> {

Callers 15

extract_functionMethod · 0.45
extract_structMethod · 0.45
extract_enumMethod · 0.45
extract_traitMethod · 0.45
extract_impl_nameMethod · 0.45
extract_type_aliasMethod · 0.45
extract_constMethod · 0.45
extract_staticMethod · 0.45
extract_modMethod · 0.45
extract_useMethod · 0.45

Calls 1

lenMethod · 0.45

Tested by

no test coverage detected