internal: Filter out opaque tokens in some of IDE feature macro descensions

This commit is contained in:
Lukas Wirth 2024-10-04 11:08:11 +02:00
parent ac4edbf9dc
commit 24d65bb7cf
11 changed files with 114 additions and 70 deletions

View file

@ -55,7 +55,10 @@ where
/// Returns all [`TextRange`]s that correspond to the given span.
///
/// Note this does a linear search through the entire backing vector.
pub fn ranges_with_span_exact(&self, span: SpanData<S>) -> impl Iterator<Item = TextRange> + '_
pub fn ranges_with_span_exact(
&self,
span: SpanData<S>,
) -> impl Iterator<Item = (TextRange, S)> + '_
where
S: Copy,
{
@ -64,14 +67,14 @@ where
return None;
}
let start = idx.checked_sub(1).map_or(TextSize::new(0), |prev| self.spans[prev].0);
Some(TextRange::new(start, end))
Some((TextRange::new(start, end), s.ctx))
})
}
/// Returns all [`TextRange`]s whose spans contain the given span.
///
/// Note this does a linear search through the entire backing vector.
pub fn ranges_with_span(&self, span: SpanData<S>) -> impl Iterator<Item = TextRange> + '_
pub fn ranges_with_span(&self, span: SpanData<S>) -> impl Iterator<Item = (TextRange, S)> + '_
where
S: Copy,
{
@ -83,7 +86,7 @@ where
return None;
}
let start = idx.checked_sub(1).map_or(TextSize::new(0), |prev| self.spans[prev].0);
Some(TextRange::new(start, end))
Some((TextRange::new(start, end), s.ctx))
})
}