diff options
Diffstat (limited to 'crates/ra_text_edit/src/lib.rs')
-rw-r--r-- | crates/ra_text_edit/src/lib.rs | 20 |
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 @@ | |||
1 | mod edit; | 1 | mod text_edit; |
2 | pub mod text_utils; | 2 | pub mod text_utils; |
3 | 3 | ||
4 | pub use crate::edit::{Edit, EditBuilder}; | 4 | pub use crate::text_edit::{TextEdit, TextEditBuilder}; |
5 | 5 | ||
6 | use text_unit::{TextRange, TextUnit}; | 6 | use text_unit::{TextRange, TextUnit}; |
7 | 7 | ||
8 | #[derive(Debug, Clone)] | 8 | #[derive(Debug, Clone)] |
9 | pub struct AtomEdit { | 9 | pub struct AtomTextEdit { |
10 | pub delete: TextRange, | 10 | pub delete: TextRange, |
11 | pub insert: String, | 11 | pub insert: String, |
12 | } | 12 | } |
13 | 13 | ||
14 | impl AtomEdit { | 14 | impl 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 | } |