diff options
author | Aleksey Kladov <[email protected]> | 2020-05-21 18:50:23 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-05-21 19:05:33 +0100 |
commit | 5b5ebec440841ee98a0aa70b71a135d94f5ca077 (patch) | |
tree | 5accb5fce10496334b49ed5a823d321572b375b4 /crates/ra_ide/src | |
parent | ba6cf638fbf3d0a025e804f2d354d91abc8afd28 (diff) |
Formalize JoinLines protocol extension
Diffstat (limited to 'crates/ra_ide/src')
-rw-r--r-- | crates/ra_ide/src/lib.rs | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/crates/ra_ide/src/lib.rs b/crates/ra_ide/src/lib.rs index d0aeb3ba7..97ff67ee8 100644 --- a/crates/ra_ide/src/lib.rs +++ b/crates/ra_ide/src/lib.rs | |||
@@ -89,6 +89,7 @@ pub use ra_ide_db::{ | |||
89 | symbol_index::Query, | 89 | symbol_index::Query, |
90 | RootDatabase, | 90 | RootDatabase, |
91 | }; | 91 | }; |
92 | pub use ra_text_edit::{Indel, TextEdit}; | ||
92 | 93 | ||
93 | pub type Cancelable<T> = Result<T, Canceled>; | 94 | pub type Cancelable<T> = Result<T, Canceled>; |
94 | 95 | ||
@@ -285,14 +286,10 @@ impl Analysis { | |||
285 | 286 | ||
286 | /// Returns an edit to remove all newlines in the range, cleaning up minor | 287 | /// Returns an edit to remove all newlines in the range, cleaning up minor |
287 | /// stuff like trailing commas. | 288 | /// stuff like trailing commas. |
288 | pub fn join_lines(&self, frange: FileRange) -> Cancelable<SourceChange> { | 289 | pub fn join_lines(&self, frange: FileRange) -> Cancelable<TextEdit> { |
289 | self.with_db(|db| { | 290 | self.with_db(|db| { |
290 | let parse = db.parse(frange.file_id); | 291 | let parse = db.parse(frange.file_id); |
291 | let file_edit = SourceFileEdit { | 292 | join_lines::join_lines(&parse.tree(), frange.range) |
292 | file_id: frange.file_id, | ||
293 | edit: join_lines::join_lines(&parse.tree(), frange.range), | ||
294 | }; | ||
295 | SourceChange::source_file_edit("Join lines", file_edit) | ||
296 | }) | 293 | }) |
297 | } | 294 | } |
298 | 295 | ||