aboutsummaryrefslogtreecommitdiff
path: root/crates/libeditor/src/typing.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/libeditor/src/typing.rs')
-rw-r--r--crates/libeditor/src/typing.rs11
1 files changed, 1 insertions, 10 deletions
diff --git a/crates/libeditor/src/typing.rs b/crates/libeditor/src/typing.rs
index 04021d164..cc0d3d272 100644
--- a/crates/libeditor/src/typing.rs
+++ b/crates/libeditor/src/typing.rs
@@ -5,6 +5,7 @@ use libsyntax2::{
5 walk::preorder, 5 walk::preorder,
6 find_covering_node, 6 find_covering_node,
7 }, 7 },
8 text_utils::intersect,
8 SyntaxKind::*, 9 SyntaxKind::*,
9}; 10};
10 11
@@ -53,16 +54,6 @@ pub fn join_lines(file: &ast::ParsedFile, range: TextRange) -> ActionResult {
53 } 54 }
54} 55}
55 56
56fn intersect(r1: TextRange, r2: TextRange) -> Option<TextRange> {
57 let start = r1.start().max(r2.start());
58 let end = r1.end().min(r2.end());
59 if start <= end {
60 Some(TextRange::from_to(start, end))
61 } else {
62 None
63 }
64}
65
66fn remove_newline( 57fn remove_newline(
67 edit: &mut EditBuilder, 58 edit: &mut EditBuilder,
68 node: SyntaxNodeRef, 59 node: SyntaxNodeRef,