Add Buffer::outline method

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Max Brunsfeld 2022-01-12 18:17:19 -08:00
parent 057dc62b90
commit 63a401ac5d
11 changed files with 224 additions and 4 deletions

View file

@ -7,7 +7,7 @@ use collections::{HashMap, HashSet};
use gpui::{AppContext, Entity, ModelContext, ModelHandle, Task};
use language::{
Buffer, BufferChunks, BufferSnapshot, Chunk, DiagnosticEntry, Event, File, Language, Selection,
ToOffset as _, ToPoint as _, TransactionId,
ToOffset as _, ToPoint as _, TransactionId, Outline,
};
use std::{
cell::{Ref, RefCell},
@ -1698,6 +1698,10 @@ impl MultiBufferSnapshot {
})
}
pub fn outline(&self) -> Option<Outline> {
self.as_singleton().and_then(move |buffer| buffer.outline())
}
fn buffer_snapshot_for_excerpt<'a>(
&'a self,
excerpt_id: &'a ExcerptId,