Extract an ExcerptRange containing a context field in multi_buffer

This lays the groundwork for adding an optional `primary` field that can
be supplied to provide the "jump to" feature.
This commit is contained in:
Antonio Scandurra 2022-06-08 12:13:04 +02:00
parent d56cc1a5c1
commit ffb75b0f02
6 changed files with 231 additions and 100 deletions

View file

@ -5,7 +5,8 @@ use collections::{BTreeMap, HashSet};
use editor::{
diagnostic_block_renderer,
display_map::{BlockDisposition, BlockId, BlockProperties, RenderBlock},
highlight_diagnostic_message, Autoscroll, Editor, ExcerptId, MultiBuffer, ToOffset,
highlight_diagnostic_message, Autoscroll, Editor, ExcerptId, ExcerptRange, MultiBuffer,
ToOffset,
};
use gpui::{
actions, elements::*, fonts::TextStyle, impl_internal_actions, platform::CursorStyle,
@ -348,7 +349,9 @@ impl ProjectDiagnosticsEditor {
.insert_excerpts_after(
&prev_excerpt_id,
buffer.clone(),
[excerpt_start..excerpt_end],
[ExcerptRange {
context: excerpt_start..excerpt_end,
}],
excerpts_cx,
)
.pop()