diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-03-22 17:56:23 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-03-22 17:56:23 +0000 |
commit | 3604f23e98d01fe9d89e5cdcf76a51cb9c1d6768 (patch) | |
tree | de867640036faf167ff07a62d22db02c37f48088 /crates/ra_ide_api/src/lib.rs | |
parent | 6e324d38d6ef3e250ff32a397f4777699e006f7f (diff) | |
parent | 01bca7114c0567961c875a1df5a60748cd872073 (diff) |
Merge #1012
1012: Move join_lines and test_utils to ra_ide_api r=matklad a=detrumi
Part of #1009
Co-authored-by: Wilco Kusee <[email protected]>
Diffstat (limited to 'crates/ra_ide_api/src/lib.rs')
-rw-r--r-- | crates/ra_ide_api/src/lib.rs | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/crates/ra_ide_api/src/lib.rs b/crates/ra_ide_api/src/lib.rs index d6f63490d..a838c30da 100644 --- a/crates/ra_ide_api/src/lib.rs +++ b/crates/ra_ide_api/src/lib.rs | |||
@@ -36,9 +36,12 @@ mod syntax_tree; | |||
36 | mod line_index; | 36 | 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 | 40 | ||
40 | #[cfg(test)] | 41 | #[cfg(test)] |
41 | mod marks; | 42 | mod marks; |
43 | #[cfg(test)] | ||
44 | mod test_utils; | ||
42 | 45 | ||
43 | use std::sync::Arc; | 46 | use std::sync::Arc; |
44 | 47 | ||
@@ -276,10 +279,16 @@ impl Analysis { | |||
276 | /// stuff like trailing commas. | 279 | /// stuff like trailing commas. |
277 | pub fn join_lines(&self, frange: FileRange) -> SourceChange { | 280 | pub fn join_lines(&self, frange: FileRange) -> SourceChange { |
278 | let file = self.db.parse(frange.file_id); | 281 | let file = self.db.parse(frange.file_id); |
279 | SourceChange::from_local_edit( | 282 | let file_edit = SourceFileEdit { |
280 | frange.file_id, | 283 | file_id: frange.file_id, |
281 | ra_ide_api_light::join_lines(&file, frange.range), | 284 | edit: join_lines::join_lines(&file, frange.range), |
282 | ) | 285 | }; |
286 | SourceChange { | ||
287 | label: "join lines".to_string(), | ||
288 | source_file_edits: vec![file_edit], | ||
289 | file_system_edits: vec![], | ||
290 | cursor_position: None, | ||
291 | } | ||
283 | } | 292 | } |
284 | 293 | ||
285 | /// Returns an edit which should be applied when opening a new line, fixing | 294 | /// Returns an edit which should be applied when opening a new line, fixing |