Allow inserting multiple excerpts in a batch

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Max Brunsfeld 2022-02-09 17:56:06 -08:00
parent aa7dfbdd9c
commit 471c23e22f
4 changed files with 118 additions and 77 deletions

View file

@ -333,12 +333,15 @@ impl ProjectDiagnosticsEditor {
Point::new(range.end.row + CONTEXT_LINE_COUNT, u32::MAX),
Bias::Left,
);
let excerpt_id = excerpts.insert_excerpt_after(
&prev_excerpt_id,
buffer.clone(),
excerpt_start..excerpt_end,
excerpts_cx,
);
let excerpt_id = excerpts
.insert_excerpts_after(
&prev_excerpt_id,
buffer.clone(),
[excerpt_start..excerpt_end],
excerpts_cx,
)
.pop()
.unwrap();
prev_excerpt_id = excerpt_id.clone();
first_excerpt_id.get_or_insert_with(|| prev_excerpt_id.clone());