mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 21:05:02 +00:00
rename Edit to TextEdit and AtomEdit to AtomTextEdit
This commit is contained in:
parent
7344d28768
commit
0527e3b283
11 changed files with 92 additions and 87 deletions
|
@ -1,29 +1,29 @@
|
|||
mod edit;
|
||||
mod text_edit;
|
||||
pub mod text_utils;
|
||||
|
||||
pub use crate::edit::{Edit, EditBuilder};
|
||||
pub use crate::text_edit::{TextEdit, TextEditBuilder};
|
||||
|
||||
use text_unit::{TextRange, TextUnit};
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct AtomEdit {
|
||||
pub struct AtomTextEdit {
|
||||
pub delete: TextRange,
|
||||
pub insert: String,
|
||||
}
|
||||
|
||||
impl AtomEdit {
|
||||
pub fn replace(range: TextRange, replace_with: String) -> AtomEdit {
|
||||
AtomEdit {
|
||||
impl AtomTextEdit {
|
||||
pub fn replace(range: TextRange, replace_with: String) -> AtomTextEdit {
|
||||
AtomTextEdit {
|
||||
delete: range,
|
||||
insert: replace_with,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn delete(range: TextRange) -> AtomEdit {
|
||||
AtomEdit::replace(range, String::new())
|
||||
pub fn delete(range: TextRange) -> AtomTextEdit {
|
||||
AtomTextEdit::replace(range, String::new())
|
||||
}
|
||||
|
||||
pub fn insert(offset: TextUnit, text: String) -> AtomEdit {
|
||||
AtomEdit::replace(TextRange::offset_len(offset, 0.into()), text)
|
||||
pub fn insert(offset: TextUnit, text: String) -> AtomTextEdit {
|
||||
AtomTextEdit::replace(TextRange::offset_len(offset, 0.into()), text)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue