mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 13:25:09 +00:00
WIP: fix: make rename
multi-token mapping aware
This commit is contained in:
parent
a3830dfd3b
commit
6decfceae1
2 changed files with 108 additions and 66 deletions
|
@ -54,6 +54,13 @@ impl SourceChange {
|
|||
pub fn get_source_edit(&self, file_id: FileId) -> Option<&TextEdit> {
|
||||
self.source_file_edits.get(&file_id)
|
||||
}
|
||||
|
||||
pub fn merge(mut self, other: SourceChange) -> SourceChange {
|
||||
self.extend(other.source_file_edits);
|
||||
self.extend(other.file_system_edits);
|
||||
self.is_snippet |= other.is_snippet; // TODO correct?
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl Extend<(FileId, TextEdit)> for SourceChange {
|
||||
|
@ -62,6 +69,12 @@ impl Extend<(FileId, TextEdit)> for SourceChange {
|
|||
}
|
||||
}
|
||||
|
||||
impl Extend<FileSystemEdit> for SourceChange {
|
||||
fn extend<T: IntoIterator<Item = FileSystemEdit>>(&mut self, iter: T) {
|
||||
iter.into_iter().for_each(|edit| self.push_file_system_edit(edit));
|
||||
}
|
||||
}
|
||||
|
||||
impl From<FxHashMap<FileId, TextEdit>> for SourceChange {
|
||||
fn from(source_file_edits: FxHashMap<FileId, TextEdit>) -> SourceChange {
|
||||
SourceChange { source_file_edits, file_system_edits: Vec::new(), is_snippet: false }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue