diff options
Diffstat (limited to 'crates/ra_ide/src/typing.rs')
-rw-r--r-- | crates/ra_ide/src/typing.rs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/crates/ra_ide/src/typing.rs b/crates/ra_ide/src/typing.rs index c408b1d52..7897c57b7 100644 --- a/crates/ra_ide/src/typing.rs +++ b/crates/ra_ide/src/typing.rs | |||
@@ -16,11 +16,10 @@ | |||
16 | mod on_enter; | 16 | mod on_enter; |
17 | 17 | ||
18 | use ra_db::{FilePosition, SourceDatabase}; | 18 | use ra_db::{FilePosition, SourceDatabase}; |
19 | use ra_fmt::leading_indent; | ||
20 | use ra_ide_db::{source_change::SourceFileEdit, RootDatabase}; | 19 | use ra_ide_db::{source_change::SourceFileEdit, RootDatabase}; |
21 | use syntax::{ | 20 | use syntax::{ |
22 | algo::find_node_at_offset, | 21 | algo::find_node_at_offset, |
23 | ast::{self, AstToken}, | 22 | ast::{self, edit::IndentLevel, AstToken}, |
24 | AstNode, SourceFile, | 23 | AstNode, SourceFile, |
25 | SyntaxKind::{FIELD_EXPR, METHOD_CALL_EXPR}, | 24 | SyntaxKind::{FIELD_EXPR, METHOD_CALL_EXPR}, |
26 | TextRange, TextSize, | 25 | TextRange, TextSize, |
@@ -104,7 +103,7 @@ fn on_dot_typed(file: &SourceFile, offset: TextSize) -> Option<TextEdit> { | |||
104 | if !matches!(parent.kind(), FIELD_EXPR | METHOD_CALL_EXPR) { | 103 | if !matches!(parent.kind(), FIELD_EXPR | METHOD_CALL_EXPR) { |
105 | return None; | 104 | return None; |
106 | } | 105 | } |
107 | let prev_indent = leading_indent(&parent)?; | 106 | let prev_indent = IndentLevel::from_node(&parent); |
108 | let target_indent = format!(" {}", prev_indent); | 107 | let target_indent = format!(" {}", prev_indent); |
109 | let target_indent_len = TextSize::of(&target_indent); | 108 | let target_indent_len = TextSize::of(&target_indent); |
110 | if current_indent_len == target_indent_len { | 109 | if current_indent_len == target_indent_len { |