Skip to content

Commit

Permalink
Reuse logic for deletion
Browse files Browse the repository at this point in the history
Summary: Avoid duplicating logic, reuse existing one.

Reviewed By: alanz

Differential Revision: D66466288

fbshipit-source-id: 7ac09e2c3f18c519a5f5e5fb520e1ddfe28cdf67
  • Loading branch information
robertoaloi authored and facebook-github-bot committed Nov 26, 2024
1 parent 342e874 commit ee15e06
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions crates/ide_assists/src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -416,12 +416,7 @@ pub fn extend_range_to_adjacent_newline(syntax: &SyntaxNode) -> TextRange {

pub fn extend_form_range_for_delete(syntax: &SyntaxNode) -> TextRange {
let orig_range = syntax.text_range();
let start = orig_range.start();
let end = match skip_trailing_newline(syntax) {
Some(end) => end.end(),
None => orig_range.end(),
};
TextRange::new(start, end)
extend_function_range_for_delete(orig_range, syntax)
}

fn extend_function_range_for_delete(orig_range: TextRange, last_syntax: &SyntaxNode) -> TextRange {
Expand Down

0 comments on commit ee15e06

Please sign in to comment.