diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-04-25 11:16:02 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-04-25 11:16:02 +0100 |
commit | 29fc409e7fe5b12dcf6bfbcca622d79c4c8fcb72 (patch) | |
tree | e42f7bd1490bca66e0786d5bf2b3194aeaa57a93 /crates/ra_ide/src/typing | |
parent | 27a7718880d93f55f905da606d108d3b3c682ab4 (diff) | |
parent | e87346950039a54c3f0b02d6056cbb92ca38eb28 (diff) |
Merge #4131
4131: Switch to text-size r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_ide/src/typing')
-rw-r--r-- | crates/ra_ide/src/typing/on_enter.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/crates/ra_ide/src/typing/on_enter.rs b/crates/ra_ide/src/typing/on_enter.rs index 6bcf2d72b..30c8c5572 100644 --- a/crates/ra_ide/src/typing/on_enter.rs +++ b/crates/ra_ide/src/typing/on_enter.rs | |||
@@ -7,7 +7,7 @@ use ra_syntax::{ | |||
7 | ast::{self, AstToken}, | 7 | ast::{self, AstToken}, |
8 | AstNode, SmolStr, SourceFile, | 8 | AstNode, SmolStr, SourceFile, |
9 | SyntaxKind::*, | 9 | SyntaxKind::*, |
10 | SyntaxToken, TextUnit, TokenAtOffset, | 10 | SyntaxToken, TextSize, TokenAtOffset, |
11 | }; | 11 | }; |
12 | use ra_text_edit::TextEdit; | 12 | use ra_text_edit::TextEdit; |
13 | 13 | ||
@@ -28,7 +28,7 @@ pub(crate) fn on_enter(db: &RootDatabase, position: FilePosition) -> Option<Sour | |||
28 | 28 | ||
29 | let prefix = comment.prefix(); | 29 | let prefix = comment.prefix(); |
30 | let comment_range = comment.syntax().text_range(); | 30 | let comment_range = comment.syntax().text_range(); |
31 | if position.offset < comment_range.start() + TextUnit::of_str(prefix) { | 31 | if position.offset < comment_range.start() + TextSize::of(prefix) { |
32 | return None; | 32 | return None; |
33 | } | 33 | } |
34 | 34 | ||
@@ -39,7 +39,7 @@ pub(crate) fn on_enter(db: &RootDatabase, position: FilePosition) -> Option<Sour | |||
39 | 39 | ||
40 | let indent = node_indent(&file, comment.syntax())?; | 40 | let indent = node_indent(&file, comment.syntax())?; |
41 | let inserted = format!("\n{}{} ", indent, prefix); | 41 | let inserted = format!("\n{}{} ", indent, prefix); |
42 | let cursor_position = position.offset + TextUnit::of_str(&inserted); | 42 | let cursor_position = position.offset + TextSize::of(&inserted); |
43 | let edit = TextEdit::insert(position.offset, inserted); | 43 | let edit = TextEdit::insert(position.offset, inserted); |
44 | 44 | ||
45 | Some( | 45 | Some( |