diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-01-08 19:03:35 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-01-08 19:03:35 +0000 |
commit | 4f4f7933b1b7ff34f8633b1686b18b2d1b994c47 (patch) | |
tree | a390d74ee5272a4a0070f5d4ea5281a04d4ba56a /crates/ra_editor/src/typing.rs | |
parent | c9e42fcf245be16958dca6571e4bccc6c29199df (diff) | |
parent | 921689b70da39160dd381e9716472827e36b03b8 (diff) |
Merge #469
469: kill text utils r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_editor/src/typing.rs')
-rw-r--r-- | crates/ra_editor/src/typing.rs | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/crates/ra_editor/src/typing.rs b/crates/ra_editor/src/typing.rs index 576caf6be..d8177f245 100644 --- a/crates/ra_editor/src/typing.rs +++ b/crates/ra_editor/src/typing.rs | |||
@@ -4,12 +4,10 @@ use itertools::Itertools; | |||
4 | use ra_syntax::{ | 4 | use ra_syntax::{ |
5 | algo::{find_node_at_offset, find_covering_node, find_leaf_at_offset, LeafAtOffset}, | 5 | algo::{find_node_at_offset, find_covering_node, find_leaf_at_offset, LeafAtOffset}, |
6 | ast, | 6 | ast, |
7 | text_utils::intersect, | ||
8 | AstNode, Direction, SourceFile, SyntaxKind, | 7 | AstNode, Direction, SourceFile, SyntaxKind, |
9 | SyntaxKind::*, | 8 | SyntaxKind::*, |
10 | SyntaxNode, TextRange, TextUnit, | 9 | SyntaxNode, TextRange, TextUnit, |
11 | }; | 10 | }; |
12 | use ra_text_edit::text_utils::contains_offset_nonstrict; | ||
13 | 11 | ||
14 | use crate::{LocalEdit, TextEditBuilder}; | 12 | use crate::{LocalEdit, TextEditBuilder}; |
15 | 13 | ||
@@ -39,7 +37,7 @@ pub fn join_lines(file: &SourceFile, range: TextRange) -> LocalEdit { | |||
39 | Some(text) => text, | 37 | Some(text) => text, |
40 | None => continue, | 38 | None => continue, |
41 | }; | 39 | }; |
42 | let range = match intersect(range, node.range()) { | 40 | let range = match range.intersection(&node.range()) { |
43 | Some(range) => range, | 41 | Some(range) => range, |
44 | None => continue, | 42 | None => continue, |
45 | } - node.range().start(); | 43 | } - node.range().start(); |
@@ -112,7 +110,7 @@ pub fn on_eq_typed(file: &SourceFile, offset: TextUnit) -> Option<LocalEdit> { | |||
112 | } | 110 | } |
113 | if let Some(expr) = let_stmt.initializer() { | 111 | if let Some(expr) = let_stmt.initializer() { |
114 | let expr_range = expr.syntax().range(); | 112 | let expr_range = expr.syntax().range(); |
115 | if contains_offset_nonstrict(expr_range, offset) && offset != expr_range.start() { | 113 | if expr_range.contains(offset) && offset != expr_range.start() { |
116 | return None; | 114 | return None; |
117 | } | 115 | } |
118 | if file | 116 | if file |