assistant2: Highlight crease on selection (#24358)
Give the inline file crease inside of `assistant2`'s editor a selection background when there is a selection over it Release Notes: - N/A --------- Co-authored-by: Piotr <piotr@zed.dev> Co-authored-by: Danilo Leal <daniloleal09@gmail.com>
This commit is contained in:
parent
78a8002415
commit
f609abb48c
5 changed files with 70 additions and 24 deletions
|
@ -2,7 +2,7 @@ use super::{
|
|||
inlay_map::{InlayBufferRows, InlayChunks, InlayEdit, InlayOffset, InlayPoint, InlaySnapshot},
|
||||
Highlights,
|
||||
};
|
||||
use gpui::{AnyElement, App, ElementId, Window};
|
||||
use gpui::{AnyElement, App, ElementId};
|
||||
use language::{Chunk, ChunkRenderer, Edit, Point, TextSummary};
|
||||
use multi_buffer::{
|
||||
Anchor, AnchorRangeExt, MultiBufferRow, MultiBufferSnapshot, RowInfo, ToOffset,
|
||||
|
@ -21,8 +21,7 @@ use util::post_inc;
|
|||
#[derive(Clone)]
|
||||
pub struct FoldPlaceholder {
|
||||
/// Creates an element to represent this fold's placeholder.
|
||||
pub render:
|
||||
Arc<dyn Send + Sync + Fn(FoldId, Range<Anchor>, &mut Window, &mut App) -> AnyElement>,
|
||||
pub render: Arc<dyn Send + Sync + Fn(FoldId, Range<Anchor>, &mut App) -> AnyElement>,
|
||||
/// If true, the element is constrained to the shaped width of an ellipsis.
|
||||
pub constrain_width: bool,
|
||||
/// If true, merges the fold with an adjacent one.
|
||||
|
@ -34,7 +33,7 @@ pub struct FoldPlaceholder {
|
|||
impl Default for FoldPlaceholder {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
render: Arc::new(|_, _, _, _| gpui::Empty.into_any_element()),
|
||||
render: Arc::new(|_, _, _| gpui::Empty.into_any_element()),
|
||||
constrain_width: true,
|
||||
merge_adjacent: true,
|
||||
type_tag: None,
|
||||
|
@ -46,7 +45,7 @@ impl FoldPlaceholder {
|
|||
#[cfg(any(test, feature = "test-support"))]
|
||||
pub fn test() -> Self {
|
||||
Self {
|
||||
render: Arc::new(|_id, _range, _window, _cx| gpui::Empty.into_any_element()),
|
||||
render: Arc::new(|_id, _range, _cx| gpui::Empty.into_any_element()),
|
||||
constrain_width: true,
|
||||
merge_adjacent: true,
|
||||
type_tag: None,
|
||||
|
@ -486,7 +485,6 @@ impl FoldMap {
|
|||
(fold.placeholder.render)(
|
||||
fold_id,
|
||||
fold.range.0.clone(),
|
||||
cx.window,
|
||||
cx.context,
|
||||
)
|
||||
}),
|
||||
|
|
|
@ -1142,7 +1142,7 @@ impl Editor {
|
|||
let editor = cx.entity().downgrade();
|
||||
let fold_placeholder = FoldPlaceholder {
|
||||
constrain_width: true,
|
||||
render: Arc::new(move |fold_id, fold_range, _, cx| {
|
||||
render: Arc::new(move |fold_id, fold_range, cx| {
|
||||
let editor = editor.clone();
|
||||
div()
|
||||
.id(fold_id)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue