aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_text_edit/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_text_edit/src/lib.rs')
-rw-r--r--crates/ra_text_edit/src/lib.rs20
1 files changed, 10 insertions, 10 deletions
diff --git a/crates/ra_text_edit/src/lib.rs b/crates/ra_text_edit/src/lib.rs
index 789471e8a..13e20f6fb 100644
--- a/crates/ra_text_edit/src/lib.rs
+++ b/crates/ra_text_edit/src/lib.rs
@@ -1,29 +1,29 @@
1mod edit; 1mod text_edit;
2pub mod text_utils; 2pub mod text_utils;
3 3
4pub use crate::edit::{Edit, EditBuilder}; 4pub use crate::text_edit::{TextEdit, TextEditBuilder};
5 5
6use text_unit::{TextRange, TextUnit}; 6use text_unit::{TextRange, TextUnit};
7 7
8#[derive(Debug, Clone)] 8#[derive(Debug, Clone)]
9pub struct AtomEdit { 9pub struct AtomTextEdit {
10 pub delete: TextRange, 10 pub delete: TextRange,
11 pub insert: String, 11 pub insert: String,
12} 12}
13 13
14impl AtomEdit { 14impl AtomTextEdit {
15 pub fn replace(range: TextRange, replace_with: String) -> AtomEdit { 15 pub fn replace(range: TextRange, replace_with: String) -> AtomTextEdit {
16 AtomEdit { 16 AtomTextEdit {
17 delete: range, 17 delete: range,
18 insert: replace_with, 18 insert: replace_with,
19 } 19 }
20 } 20 }
21 21
22 pub fn delete(range: TextRange) -> AtomEdit { 22 pub fn delete(range: TextRange) -> AtomTextEdit {
23 AtomEdit::replace(range, String::new()) 23 AtomTextEdit::replace(range, String::new())
24 } 24 }
25 25
26 pub fn insert(offset: TextUnit, text: String) -> AtomEdit { 26 pub fn insert(offset: TextUnit, text: String) -> AtomTextEdit {
27 AtomEdit::replace(TextRange::offset_len(offset, 0.into()), text) 27 AtomTextEdit::replace(TextRange::offset_len(offset, 0.into()), text)
28 } 28 }
29} 29}