diff options
Diffstat (limited to 'support/texlab/crates/rename/src/lib.rs')
-rw-r--r-- | support/texlab/crates/rename/src/lib.rs | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/support/texlab/crates/rename/src/lib.rs b/support/texlab/crates/rename/src/lib.rs index bf9023ddef..e6c05ad268 100644 --- a/support/texlab/crates/rename/src/lib.rs +++ b/support/texlab/crates/rename/src/lib.rs @@ -13,8 +13,14 @@ pub struct RenameParams<'a> { } #[derive(Debug, Default)] +pub struct RenameInformation { + pub range: TextRange, + pub prefix: Option<String>, +} + +#[derive(Debug, Default)] pub struct RenameResult<'a> { - pub changes: FxHashMap<&'a Document, Vec<TextRange>>, + pub changes: FxHashMap<&'a Document, Vec<RenameInformation>>, } struct RenameBuilder<'a> { @@ -22,6 +28,20 @@ struct RenameBuilder<'a> { result: RenameResult<'a>, } +impl From<TextRange> for RenameInformation { + fn from(range: TextRange) -> Self { + RenameInformation { + range, + prefix: None, + } + } +} +impl PartialEq for RenameInformation { + fn eq(&self, other: &Self) -> bool { + self.range == other.range + } +} + pub fn prepare_rename(params: &RenameParams) -> Option<TextRange> { command::prepare_rename(params) .or_else(|| entry::prepare_rename(params)) |