Don't select the current node in select_nodes
This commit is contained in:
parent
2c17cea19e
commit
1ccccb370b
14
src/main.rs
14
src/main.rs
|
@ -215,15 +215,11 @@ fn handle_request(config: &Config, request: &Request) -> String {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn select_nodes(node: &Node, kinds: &[String], new_ranges: &mut Vec<Range>) {
|
fn select_nodes(node: &Node, kinds: &[String], new_ranges: &mut Vec<Range>) {
|
||||||
if kinds.iter().any(|kind| kind == node.kind()) {
|
for child in tree::named_children(&node) {
|
||||||
new_ranges.push(node.range());
|
if kinds.iter().any(|kind| kind == child.kind()) {
|
||||||
} else {
|
new_ranges.push(child.range());
|
||||||
for child in tree::named_children(&node) {
|
} else {
|
||||||
if kinds.iter().any(|kind| kind == child.kind()) {
|
select_nodes(&child, kinds, new_ranges);
|
||||||
new_ranges.push(child.range());
|
|
||||||
} else {
|
|
||||||
select_nodes(&child, kinds, new_ranges);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user