diff options
Diffstat (limited to 'crates/ra_ide_api/src/typing.rs')
-rw-r--r-- | crates/ra_ide_api/src/typing.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/crates/ra_ide_api/src/typing.rs b/crates/ra_ide_api/src/typing.rs index ad0ababcc..1747a529e 100644 --- a/crates/ra_ide_api/src/typing.rs +++ b/crates/ra_ide_api/src/typing.rs | |||
@@ -24,7 +24,7 @@ pub(crate) fn on_enter(db: &RootDatabase, position: FilePosition) -> Option<Sour | |||
24 | 24 | ||
25 | let prefix = comment.prefix(); | 25 | let prefix = comment.prefix(); |
26 | if position.offset | 26 | if position.offset |
27 | < comment.syntax().range().start() + TextUnit::of_str(prefix) + TextUnit::from(1) | 27 | < comment.syntax().text_range().start() + TextUnit::of_str(prefix) + TextUnit::from(1) |
28 | { | 28 | { |
29 | return None; | 29 | return None; |
30 | } | 30 | } |
@@ -45,7 +45,7 @@ pub(crate) fn on_enter(db: &RootDatabase, position: FilePosition) -> Option<Sour | |||
45 | } | 45 | } |
46 | 46 | ||
47 | fn node_indent(file: &SourceFile, token: &SyntaxToken) -> Option<SmolStr> { | 47 | fn node_indent(file: &SourceFile, token: &SyntaxToken) -> Option<SmolStr> { |
48 | let ws = match find_token_at_offset(file.syntax(), token.range().start()) { | 48 | let ws = match find_token_at_offset(file.syntax(), token.text_range().start()) { |
49 | TokenAtOffset::Between(l, r) => { | 49 | TokenAtOffset::Between(l, r) => { |
50 | assert!(r == *token); | 50 | assert!(r == *token); |
51 | l | 51 | l |
@@ -71,7 +71,7 @@ pub fn on_eq_typed(file: &SourceFile, eq_offset: TextUnit) -> Option<TextEdit> { | |||
71 | return None; | 71 | return None; |
72 | } | 72 | } |
73 | if let Some(expr) = let_stmt.initializer() { | 73 | if let Some(expr) = let_stmt.initializer() { |
74 | let expr_range = expr.syntax().range(); | 74 | let expr_range = expr.syntax().text_range(); |
75 | if expr_range.contains(eq_offset) && eq_offset != expr_range.start() { | 75 | if expr_range.contains(eq_offset) && eq_offset != expr_range.start() { |
76 | return None; | 76 | return None; |
77 | } | 77 | } |
@@ -81,7 +81,7 @@ pub fn on_eq_typed(file: &SourceFile, eq_offset: TextUnit) -> Option<TextEdit> { | |||
81 | } else { | 81 | } else { |
82 | return None; | 82 | return None; |
83 | } | 83 | } |
84 | let offset = let_stmt.syntax().range().end(); | 84 | let offset = let_stmt.syntax().text_range().end(); |
85 | let mut edit = TextEditBuilder::default(); | 85 | let mut edit = TextEditBuilder::default(); |
86 | edit.insert(offset, ";".to_string()); | 86 | edit.insert(offset, ";".to_string()); |
87 | Some(edit.finish()) | 87 | Some(edit.finish()) |