Get rid of $crate in expansions shown to the user

Be it "Expand Macro Recursively", "Inline macro" or few other things.

We replace it with the crate name, as should've always been.
This commit is contained in:
Chayim Refael Friedman 2024-09-17 23:31:36 +03:00
parent 94b526fc86
commit cfb701ac78
15 changed files with 396 additions and 64 deletions

View file

@ -104,6 +104,31 @@ where
pub fn iter(&self) -> impl Iterator<Item = (TextSize, SpanData<S>)> + '_ {
self.spans.iter().copied()
}
/// Merges this span map with another span map, where `other` is inserted at (and replaces) `other_range`.
///
/// The length of the replacement node needs to be `other_size`.
pub fn merge(&mut self, other_range: TextRange, other_size: TextSize, other: &SpanMap<S>) {
self.spans.retain_mut(|(offset, _)| {
if other_range.contains(*offset) {
false
} else {
if *offset >= other_range.end() {
*offset += other_size;
*offset -= other_range.len();
}
true
}
});
self.spans
.extend(other.spans.iter().map(|&(offset, span)| (offset + other_range.start(), span)));
self.spans.sort_unstable_by_key(|&(offset, _)| offset);
// Matched arm info is no longer correct once we have multiple macros.
self.matched_arm = None;
}
}
#[derive(PartialEq, Eq, Hash, Debug)]