aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src/lib.rs
diff options
context:
space:
mode:
authorWilco Kusee <[email protected]>2019-03-23 11:07:21 +0000
committerWilco Kusee <[email protected]>2019-03-23 11:11:46 +0000
commit0c15deac760a654f03de3ae433e5260b5bdfb8c2 (patch)
tree89d7c73cb325fa14db2c6e16e8d906548849a730 /crates/ra_ide_api/src/lib.rs
parentd99abe4c252447c9940f77568a96c9a96f6f8905 (diff)
Move typing to ra_ide_api
Diffstat (limited to 'crates/ra_ide_api/src/lib.rs')
-rw-r--r--crates/ra_ide_api/src/lib.rs7
1 files changed, 4 insertions, 3 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;
37mod folding_ranges; 37mod folding_ranges;
38mod line_index_utils; 38mod line_index_utils;
39mod join_lines; 39mod join_lines;
40mod typing;
40 41
41#[cfg(test)] 42#[cfg(test)]
42mod marks; 43mod 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