diff options
-rw-r--r-- | crates/ra_ide_api/src/lib.rs | 7 | ||||
-rw-r--r-- | crates/ra_ide_api/src/typing.rs (renamed from crates/ra_ide_api_light/src/typing.rs) | 3 | ||||
-rw-r--r-- | crates/ra_ide_api_light/src/lib.rs | 3 |
3 files changed, 6 insertions, 7 deletions
diff --git a/crates/ra_ide_api/src/lib.rs b/crates/ra_ide_api/src/lib.rs index a838c30da..c2ef61ae2 100644 --- a/crates/ra_ide_api/src/lib.rs +++ b/crates/ra_ide_api/src/lib.rs | |||
@@ -37,6 +37,7 @@ mod line_index; | |||
37 | mod folding_ranges; | 37 | mod folding_ranges; |
38 | mod line_index_utils; | 38 | mod line_index_utils; |
39 | mod join_lines; | 39 | mod join_lines; |
40 | mod typing; | ||
40 | 41 | ||
41 | #[cfg(test)] | 42 | #[cfg(test)] |
42 | mod marks; | 43 | mod marks; |
@@ -295,7 +296,7 @@ impl Analysis { | |||
295 | /// up minor stuff like continuing the comment. | 296 | /// up minor stuff like continuing the comment. |
296 | pub fn on_enter(&self, position: FilePosition) -> Option<SourceChange> { | 297 | pub fn on_enter(&self, position: FilePosition) -> Option<SourceChange> { |
297 | let file = self.db.parse(position.file_id); | 298 | let file = self.db.parse(position.file_id); |
298 | let edit = ra_ide_api_light::on_enter(&file, position.offset)?; | 299 | let edit = typing::on_enter(&file, position.offset)?; |
299 | Some(SourceChange::from_local_edit(position.file_id, edit)) | 300 | Some(SourceChange::from_local_edit(position.file_id, edit)) |
300 | } | 301 | } |
301 | 302 | ||
@@ -304,14 +305,14 @@ impl Analysis { | |||
304 | // FIXME: use a snippet completion instead of this hack here. | 305 | // FIXME: use a snippet completion instead of this hack here. |
305 | pub fn on_eq_typed(&self, position: FilePosition) -> Option<SourceChange> { | 306 | pub fn on_eq_typed(&self, position: FilePosition) -> Option<SourceChange> { |
306 | let file = self.db.parse(position.file_id); | 307 | let file = self.db.parse(position.file_id); |
307 | let edit = ra_ide_api_light::on_eq_typed(&file, position.offset)?; | 308 | let edit = typing::on_eq_typed(&file, position.offset)?; |
308 | Some(SourceChange::from_local_edit(position.file_id, edit)) | 309 | Some(SourceChange::from_local_edit(position.file_id, edit)) |
309 | } | 310 | } |
310 | 311 | ||
311 | /// Returns an edit which should be applied when a dot ('.') is typed on a blank line, indenting the line appropriately. | 312 | /// Returns an edit which should be applied when a dot ('.') is typed on a blank line, indenting the line appropriately. |
312 | pub fn on_dot_typed(&self, position: FilePosition) -> Option<SourceChange> { | 313 | pub fn on_dot_typed(&self, position: FilePosition) -> Option<SourceChange> { |
313 | let file = self.db.parse(position.file_id); | 314 | let file = self.db.parse(position.file_id); |
314 | let edit = ra_ide_api_light::on_dot_typed(&file, position.offset)?; | 315 | let edit = typing::on_dot_typed(&file, position.offset)?; |
315 | Some(SourceChange::from_local_edit(position.file_id, edit)) | 316 | Some(SourceChange::from_local_edit(position.file_id, edit)) |
316 | } | 317 | } |
317 | 318 | ||
diff --git a/crates/ra_ide_api_light/src/typing.rs b/crates/ra_ide_api/src/typing.rs index c69270333..b7e023d60 100644 --- a/crates/ra_ide_api_light/src/typing.rs +++ b/crates/ra_ide_api/src/typing.rs | |||
@@ -5,7 +5,8 @@ use ra_syntax::{ | |||
5 | ast::{self, AstToken}, | 5 | ast::{self, AstToken}, |
6 | }; | 6 | }; |
7 | use ra_fmt::leading_indent; | 7 | use ra_fmt::leading_indent; |
8 | use crate::{LocalEdit, TextEditBuilder}; | 8 | use crate::LocalEdit; |
9 | use ra_text_edit::TextEditBuilder; | ||
9 | 10 | ||
10 | pub fn on_enter(file: &SourceFile, offset: TextUnit) -> Option<LocalEdit> { | 11 | pub fn on_enter(file: &SourceFile, offset: TextUnit) -> Option<LocalEdit> { |
11 | let comment = | 12 | let comment = |
diff --git a/crates/ra_ide_api_light/src/lib.rs b/crates/ra_ide_api_light/src/lib.rs index f21a91e18..0d928745f 100644 --- a/crates/ra_ide_api_light/src/lib.rs +++ b/crates/ra_ide_api_light/src/lib.rs | |||
@@ -4,10 +4,8 @@ | |||
4 | //! an edit or some auxiliary info. | 4 | //! an edit or some auxiliary info. |
5 | 5 | ||
6 | mod structure; | 6 | mod structure; |
7 | mod typing; | ||
8 | 7 | ||
9 | use rustc_hash::FxHashSet; | 8 | use rustc_hash::FxHashSet; |
10 | use ra_text_edit::TextEditBuilder; | ||
11 | use ra_syntax::{ | 9 | use ra_syntax::{ |
12 | SourceFile, SyntaxNode, TextRange, TextUnit, Direction, | 10 | SourceFile, SyntaxNode, TextRange, TextUnit, Direction, |
13 | algo::find_leaf_at_offset, | 11 | algo::find_leaf_at_offset, |
@@ -17,7 +15,6 @@ use ra_syntax::{ | |||
17 | 15 | ||
18 | pub use crate::{ | 16 | pub use crate::{ |
19 | structure::{file_structure, StructureNode}, | 17 | structure::{file_structure, StructureNode}, |
20 | typing::{on_enter, on_dot_typed, on_eq_typed}, | ||
21 | }; | 18 | }; |
22 | 19 | ||
23 | #[derive(Debug)] | 20 | #[derive(Debug)] |