mirror of
https://github.com/zed-industries/zed.git
synced 2025-02-11 12:46:07 +00:00
Optimize summaries_for_anchors
when MultiBuffer
is a singleton
This commit is contained in:
parent
ab26a175a4
commit
7865c32727
1 changed files with 7 additions and 0 deletions
|
@ -1543,6 +1543,13 @@ impl MultiBufferSnapshot {
|
||||||
D: TextDimension + Ord + Sub<D, Output = D>,
|
D: TextDimension + Ord + Sub<D, Output = D>,
|
||||||
I: 'a + IntoIterator<Item = &'a Anchor>,
|
I: 'a + IntoIterator<Item = &'a Anchor>,
|
||||||
{
|
{
|
||||||
|
if let Some(excerpt) = self.as_singleton() {
|
||||||
|
return excerpt
|
||||||
|
.buffer
|
||||||
|
.summaries_for_anchors(anchors.into_iter().map(|a| &a.text_anchor))
|
||||||
|
.collect();
|
||||||
|
}
|
||||||
|
|
||||||
let mut anchors = anchors.into_iter().peekable();
|
let mut anchors = anchors.into_iter().peekable();
|
||||||
let mut cursor = self.excerpts.cursor::<ExcerptSummary>();
|
let mut cursor = self.excerpts.cursor::<ExcerptSummary>();
|
||||||
let mut summaries = Vec::new();
|
let mut summaries = Vec::new();
|
||||||
|
|
Loading…
Reference in a new issue