Skip to content

Commit 58e7766

Browse files
committed
Move join_lines to ra_ide_api
1 parent 6e324d3 commit 58e7766

File tree

7 files changed

+10
-13
lines changed

7 files changed

+10
-13
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/ra_ide_api/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ ra_syntax = { path = "../ra_syntax" }
2323
ra_ide_api_light = { path = "../ra_ide_api_light" }
2424
ra_text_edit = { path = "../ra_text_edit" }
2525
ra_db = { path = "../ra_db" }
26+
ra_fmt = { path = "../ra_fmt" }
2627
hir = { path = "../ra_hir", package = "ra_hir" }
2728
test_utils = { path = "../test_utils" }
2829
ra_assists = { path = "../ra_assists" }

crates/ra_ide_api_light/src/join_lines.rs renamed to crates/ra_ide_api/src/join_lines.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@ use ra_syntax::{
99
use ra_fmt::{
1010
compute_ws, extract_trivial_expression
1111
};
12-
use crate::{
13-
LocalEdit, TextEditBuilder,
14-
};
12+
use ra_text_edit::TextEditBuilder;
13+
use ra_ide_api_light::LocalEdit;
1514

1615
pub fn join_lines(file: &SourceFile, range: TextRange) -> LocalEdit {
1716
let range = if range.is_empty() {

crates/ra_ide_api/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,12 @@ mod syntax_tree;
3636
mod line_index;
3737
mod folding_ranges;
3838
mod line_index_utils;
39+
mod join_lines;
3940

4041
#[cfg(test)]
4142
mod marks;
43+
#[cfg(test)]
44+
mod test_utils;
4245

4346
use std::sync::Arc;
4447

@@ -276,10 +279,7 @@ impl Analysis {
276279
/// stuff like trailing commas.
277280
pub fn join_lines(&self, frange: FileRange) -> SourceChange {
278281
let file = self.db.parse(frange.file_id);
279-
SourceChange::from_local_edit(
280-
frange.file_id,
281-
ra_ide_api_light::join_lines(&file, frange.range),
282-
)
282+
SourceChange::from_local_edit(frange.file_id, join_lines::join_lines(&file, frange.range))
283283
}
284284

285285
/// Returns an edit which should be applied when opening a new line, fixing

crates/ra_ide_api_light/src/lib.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
//! an edit or some auxiliary info.
55
66
mod structure;
7-
#[cfg(test)]
8-
mod test_utils;
9-
mod join_lines;
107
mod typing;
118

129
use rustc_hash::FxHashSet;
@@ -20,7 +17,6 @@ use ra_syntax::{
2017

2118
pub use crate::{
2219
structure::{file_structure, StructureNode},
23-
join_lines::join_lines,
2420
typing::{on_enter, on_dot_typed, on_eq_typed},
2521
};
2622

@@ -118,7 +114,7 @@ mod tests {
118114
use ra_syntax::AstNode;
119115
use insta::assert_debug_snapshot_matches;
120116

121-
use crate::test_utils::{add_cursor, assert_eq_text, extract_offset};
117+
use test_utils::{add_cursor, assert_eq_text, extract_offset};
122118

123119
use super::*;
124120

crates/ra_ide_api_light/src/typing.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ pub fn on_dot_typed(file: &SourceFile, dot_offset: TextUnit) -> Option<LocalEdit
118118

119119
#[cfg(test)]
120120
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};
122122

123123
use super::*;
124124

0 commit comments

Comments
 (0)