Skip to content

Commit

Permalink
Merge pull request #3 from Screwtapello/alt-child-selection
Browse files Browse the repository at this point in the history
Simplify the SelectChildren operation.
  • Loading branch information
ul authored Dec 29, 2018
2 parents 588625e + 515402e commit 9a8cdca
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,15 +205,10 @@ fn handle_request(config: &Config, request: &Request) -> String {
Op::SelectChildren => {
for range in &ranges {
let node = find_range_superset_deepest_node(&tree, range);
let node = traverse_up_to_node_which_matters(filetype_config, node);
if node.named_child_count() > 0 {
for child in named_children(&node) {
if node_matters(filetype_config, child.kind()) {
new_ranges.push(child.range());
}
for child in named_children(&node) {
if node_matters(filetype_config, child.kind()) {
new_ranges.push(child.range());
}
} else {
new_ranges.push(node.range());
}
}
select_ranges(&buffer, &new_ranges)
Expand Down

0 comments on commit 9a8cdca

Please sign in to comment.