Don't select the current node in select_nodes

This commit is contained in:
xenia 2023-11-13 18:46:34 +01:00
parent 2c17cea19e
commit 1ccccb370b

View File

@ -215,9 +215,6 @@ 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()) {
new_ranges.push(node.range());
} else {
for child in tree::named_children(&node) { for child in tree::named_children(&node) {
if kinds.iter().any(|kind| kind == child.kind()) { if kinds.iter().any(|kind| kind == child.kind()) {
new_ranges.push(child.range()); new_ranges.push(child.range());
@ -226,7 +223,6 @@ fn select_nodes(node: &Node, kinds: &[String], new_ranges: &mut Vec<Range>) {
} }
} }
} }
}
fn traverse_up_to_node_which_matters<'a>( fn traverse_up_to_node_which_matters<'a>(
filetype_config: &FiletypeConfig, filetype_config: &FiletypeConfig,