Skip to content

Commit df1293f

Browse files
committed
Move join_lines to ra_ide_api
1 parent 51323a8 commit df1293f

File tree

7 files changed

+12
-13
lines changed

7 files changed

+12
-13
lines changed

Cargo.lock

Lines changed: 2 additions & 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: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ fst = "0.3.1"
1414
rustc-hash = "1.0"
1515
parking_lot = "0.7.0"
1616
unicase = "2.2.0"
17+
superslice = "1.0.0"
1718

1819
jemallocator = { version = "0.1.9", optional = true }
1920
jemalloc-ctl = { version = "0.2.0", optional = true }
@@ -22,6 +23,7 @@ ra_syntax = { path = "../ra_syntax" }
2223
ra_ide_api_light = { path = "../ra_ide_api_light" }
2324
ra_text_edit = { path = "../ra_text_edit" }
2425
ra_db = { path = "../ra_db" }
26+
ra_fmt = { path = "../ra_fmt" }
2527
hir = { path = "../ra_hir", package = "ra_hir" }
2628
test_utils = { path = "../test_utils" }
2729
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
@@ -33,9 +33,12 @@ mod impls;
3333
mod assists;
3434
mod diagnostics;
3535
mod syntax_tree;
36+
mod join_lines;
3637

3738
#[cfg(test)]
3839
mod marks;
40+
#[cfg(test)]
41+
mod test_utils;
3942

4043
use std::sync::Arc;
4144

@@ -271,10 +274,7 @@ impl Analysis {
271274
/// stuff like trailing commas.
272275
pub fn join_lines(&self, frange: FileRange) -> SourceChange {
273276
let file = self.db.parse(frange.file_id);
274-
SourceChange::from_local_edit(
275-
frange.file_id,
276-
ra_ide_api_light::join_lines(&file, frange.range),
277-
)
277+
SourceChange::from_local_edit(frange.file_id, join_lines::join_lines(&file, frange.range))
278278
}
279279

280280
/// 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
@@ -7,9 +7,6 @@ mod folding_ranges;
77
mod line_index;
88
mod line_index_utils;
99
mod structure;
10-
#[cfg(test)]
11-
mod test_utils;
12-
mod join_lines;
1310
mod typing;
1411

1512
use rustc_hash::FxHashSet;
@@ -26,7 +23,6 @@ pub use crate::{
2623
line_index::{LineCol, LineIndex},
2724
line_index_utils::translate_offset_with_edit,
2825
structure::{file_structure, StructureNode},
29-
join_lines::join_lines,
3026
typing::{on_enter, on_dot_typed, on_eq_typed},
3127
};
3228

@@ -124,7 +120,7 @@ mod tests {
124120
use ra_syntax::AstNode;
125121
use insta::assert_debug_snapshot_matches;
126122

127-
use crate::test_utils::{add_cursor, assert_eq_text, extract_offset};
123+
use test_utils::{add_cursor, assert_eq_text, extract_offset};
128124

129125
use super::*;
130126

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)