diff options
-rw-r--r-- | Cargo.lock | 1 | ||||
-rw-r--r-- | crates/ra_ide_api/Cargo.toml | 1 | ||||
-rw-r--r-- | crates/ra_ide_api/src/join_lines.rs (renamed from crates/ra_ide_api_light/src/join_lines.rs) | 5 | ||||
-rw-r--r-- | crates/ra_ide_api/src/lib.rs | 8 | ||||
-rw-r--r-- | crates/ra_ide_api/src/test_utils.rs (renamed from crates/ra_ide_api_light/src/test_utils.rs) | 0 | ||||
-rw-r--r-- | crates/ra_ide_api_light/src/lib.rs | 6 | ||||
-rw-r--r-- | crates/ra_ide_api_light/src/typing.rs | 2 |
7 files changed, 10 insertions, 13 deletions
diff --git a/Cargo.lock b/Cargo.lock index 9c7afe74b..eafe8d64b 100644 --- a/Cargo.lock +++ b/Cargo.lock | |||
@@ -1008,6 +1008,7 @@ dependencies = [ | |||
1008 | "proptest 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", | 1008 | "proptest 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", |
1009 | "ra_assists 0.1.0", | 1009 | "ra_assists 0.1.0", |
1010 | "ra_db 0.1.0", | 1010 | "ra_db 0.1.0", |
1011 | "ra_fmt 0.1.0", | ||
1011 | "ra_hir 0.1.0", | 1012 | "ra_hir 0.1.0", |
1012 | "ra_ide_api_light 0.1.0", | 1013 | "ra_ide_api_light 0.1.0", |
1013 | "ra_syntax 0.1.0", | 1014 | "ra_syntax 0.1.0", |
diff --git a/crates/ra_ide_api/Cargo.toml b/crates/ra_ide_api/Cargo.toml index ac8c8057b..8bd5eec2b 100644 --- a/crates/ra_ide_api/Cargo.toml +++ b/crates/ra_ide_api/Cargo.toml | |||
@@ -23,6 +23,7 @@ ra_syntax = { path = "../ra_syntax" } | |||
23 | ra_ide_api_light = { path = "../ra_ide_api_light" } | 23 | ra_ide_api_light = { path = "../ra_ide_api_light" } |
24 | ra_text_edit = { path = "../ra_text_edit" } | 24 | ra_text_edit = { path = "../ra_text_edit" } |
25 | ra_db = { path = "../ra_db" } | 25 | ra_db = { path = "../ra_db" } |
26 | ra_fmt = { path = "../ra_fmt" } | ||
26 | hir = { path = "../ra_hir", package = "ra_hir" } | 27 | hir = { path = "../ra_hir", package = "ra_hir" } |
27 | test_utils = { path = "../test_utils" } | 28 | test_utils = { path = "../test_utils" } |
28 | ra_assists = { path = "../ra_assists" } | 29 | ra_assists = { path = "../ra_assists" } |
diff --git a/crates/ra_ide_api_light/src/join_lines.rs b/crates/ra_ide_api/src/join_lines.rs index b5bcd62fb..d6274dc97 100644 --- a/crates/ra_ide_api_light/src/join_lines.rs +++ b/crates/ra_ide_api/src/join_lines.rs | |||
@@ -9,9 +9,8 @@ use ra_syntax::{ | |||
9 | use ra_fmt::{ | 9 | use ra_fmt::{ |
10 | compute_ws, extract_trivial_expression | 10 | compute_ws, extract_trivial_expression |
11 | }; | 11 | }; |
12 | use crate::{ | 12 | use ra_text_edit::TextEditBuilder; |
13 | LocalEdit, TextEditBuilder, | 13 | use ra_ide_api_light::LocalEdit; |
14 | }; | ||
15 | 14 | ||
16 | pub fn join_lines(file: &SourceFile, range: TextRange) -> LocalEdit { | 15 | pub fn join_lines(file: &SourceFile, range: TextRange) -> LocalEdit { |
17 | let range = if range.is_empty() { | 16 | let range = if range.is_empty() { |
diff --git a/crates/ra_ide_api/src/lib.rs b/crates/ra_ide_api/src/lib.rs index d6f63490d..9e76dabff 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,7 @@ 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 | SourceChange::from_local_edit(frange.file_id, join_lines::join_lines(&file, frange.range)) |
280 | frange.file_id, | ||
281 | ra_ide_api_light::join_lines(&file, frange.range), | ||
282 | ) | ||
283 | } | 283 | } |
284 | 284 | ||
285 | /// Returns an edit which should be applied when opening a new line, fixing | 285 | /// Returns an edit which should be applied when opening a new line, fixing |
diff --git a/crates/ra_ide_api_light/src/test_utils.rs b/crates/ra_ide_api/src/test_utils.rs index bfac0fce3..bfac0fce3 100644 --- a/crates/ra_ide_api_light/src/test_utils.rs +++ b/crates/ra_ide_api/src/test_utils.rs | |||
diff --git a/crates/ra_ide_api_light/src/lib.rs b/crates/ra_ide_api_light/src/lib.rs index 4036a598e..f21a91e18 100644 --- a/crates/ra_ide_api_light/src/lib.rs +++ b/crates/ra_ide_api_light/src/lib.rs | |||
@@ -4,9 +4,6 @@ | |||
4 | //! an edit or some auxiliary info. | 4 | //! an edit or some auxiliary info. |
5 | 5 | ||
6 | mod structure; | 6 | mod structure; |
7 | #[cfg(test)] | ||
8 | mod test_utils; | ||
9 | mod join_lines; | ||
10 | mod typing; | 7 | mod typing; |
11 | 8 | ||
12 | use rustc_hash::FxHashSet; | 9 | use rustc_hash::FxHashSet; |
@@ -20,7 +17,6 @@ use ra_syntax::{ | |||
20 | 17 | ||
21 | pub use crate::{ | 18 | pub use crate::{ |
22 | structure::{file_structure, StructureNode}, | 19 | structure::{file_structure, StructureNode}, |
23 | join_lines::join_lines, | ||
24 | typing::{on_enter, on_dot_typed, on_eq_typed}, | 20 | typing::{on_enter, on_dot_typed, on_eq_typed}, |
25 | }; | 21 | }; |
26 | 22 | ||
@@ -118,7 +114,7 @@ mod tests { | |||
118 | use ra_syntax::AstNode; | 114 | use ra_syntax::AstNode; |
119 | use insta::assert_debug_snapshot_matches; | 115 | use insta::assert_debug_snapshot_matches; |
120 | 116 | ||
121 | use crate::test_utils::{add_cursor, assert_eq_text, extract_offset}; | 117 | use test_utils::{add_cursor, assert_eq_text, extract_offset}; |
122 | 118 | ||
123 | use super::*; | 119 | use super::*; |
124 | 120 | ||
diff --git a/crates/ra_ide_api_light/src/typing.rs b/crates/ra_ide_api_light/src/typing.rs index 9dd9f1c1d..c69270333 100644 --- a/crates/ra_ide_api_light/src/typing.rs +++ b/crates/ra_ide_api_light/src/typing.rs | |||
@@ -118,7 +118,7 @@ pub fn on_dot_typed(file: &SourceFile, dot_offset: TextUnit) -> Option<LocalEdit | |||
118 | 118 | ||
119 | #[cfg(test)] | 119 | #[cfg(test)] |
120 | mod tests { | 120 | mod tests { |
121 | use crate::test_utils::{add_cursor, assert_eq_text, extract_offset}; | 121 | use test_utils::{add_cursor, assert_eq_text, extract_offset}; |
122 | 122 | ||
123 | use super::*; | 123 | use super::*; |
124 | 124 | ||