diff options
author | Aleksey Kladov <[email protected]> | 2019-01-08 18:50:04 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-01-08 18:50:04 +0000 |
commit | f553837c1ca30a52bf5091689c21d3c3e3362395 (patch) | |
tree | 79dbabf6137e6aaf64d494f57a7cecbf397237bc /crates/ra_editor | |
parent | c9e42fcf245be16958dca6571e4bccc6c29199df (diff) |
upstream text-utils to text_unit
Diffstat (limited to 'crates/ra_editor')
-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 |