Add staged checkboxes to multibuffer headers (#24308)

Co-authored-by: Mikayla <mikayla@zed.dev>

Release Notes:

- N/A

---------

Co-authored-by: Mikayla <mikayla@zed.dev>
This commit is contained in:
Conrad Irwin 2025-02-05 18:32:07 -07:00 committed by GitHub
parent 0671be215f
commit 5d1c56829a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 151 additions and 37 deletions

View file

@ -124,7 +124,8 @@ pub use multi_buffer::{
ToOffset, ToPoint,
};
use multi_buffer::{
ExpandExcerptDirection, MultiBufferDiffHunk, MultiBufferPoint, MultiBufferRow, ToOffsetUtf16,
ExcerptInfo, ExpandExcerptDirection, MultiBufferDiffHunk, MultiBufferPoint, MultiBufferRow,
ToOffsetUtf16,
};
use project::{
lsp_store::{FormatTrigger, LspFormatTarget, OpenLspBufferHandle},
@ -580,6 +581,15 @@ struct BufferOffset(usize);
pub trait Addon: 'static {
fn extend_key_context(&self, _: &mut KeyContext, _: &App) {}
fn render_buffer_header_controls(
&self,
_: &ExcerptInfo,
_: &Window,
_: &App,
) -> Option<AnyElement> {
None
}
fn to_any(&self) -> &dyn std::any::Any;
}

View file

@ -2633,6 +2633,16 @@ impl EditorElement {
),
)
})
.children(
self.editor
.read(cx)
.addons
.values()
.filter_map(|addon| {
addon.render_buffer_header_controls(for_excerpt, window, cx)
})
.take(1),
)
.child(
h_flex()
.cursor_pointer()