diff options
Diffstat (limited to 'crates/ra_ide')
-rw-r--r-- | crates/ra_ide/Cargo.toml | 1 | ||||
-rw-r--r-- | crates/ra_ide/src/typing.rs | 5 |
2 files changed, 2 insertions, 4 deletions
diff --git a/crates/ra_ide/Cargo.toml b/crates/ra_ide/Cargo.toml index c60e55545..938398a41 100644 --- a/crates/ra_ide/Cargo.toml +++ b/crates/ra_ide/Cargo.toml | |||
@@ -26,7 +26,6 @@ text_edit = { path = "../text_edit" } | |||
26 | ra_db = { path = "../ra_db" } | 26 | ra_db = { path = "../ra_db" } |
27 | ra_ide_db = { path = "../ra_ide_db" } | 27 | ra_ide_db = { path = "../ra_ide_db" } |
28 | cfg = { path = "../cfg" } | 28 | cfg = { path = "../cfg" } |
29 | ra_fmt = { path = "../ra_fmt" } | ||
30 | profile = { path = "../profile" } | 29 | profile = { path = "../profile" } |
31 | test_utils = { path = "../test_utils" } | 30 | test_utils = { path = "../test_utils" } |
32 | ra_assists = { path = "../ra_assists" } | 31 | ra_assists = { path = "../ra_assists" } |
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 { |