Get the text content of a node.
(&self, node: &Node, source: &str)
| 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> { |
no test coverage detected