Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Progress on diagnostic multibuffer
Nate Butler2bf48872b640
diff --git a/crates/editor2/src/element.rs b/crates/editor2/src/element.rsindex 95f6e99589e..824b8c7df83 100644--- a/crates/editor2/src/element.rs+++ b/crates/editor2/src/element.rs@@ -2225,7 +2225,8 @@ impl EditorElement {.as_ref().map(|project| project.read(cx).visible_worktrees(cx).count() > 1).unwrap_or_default();- let jump_icon = project::File::from_dyn(buffer.file()).map(|file| {++ let jump_handler = project::File::from_dyn(buffer.file()).map(|file| {let jump_path = ProjectPath {worktree_id: file.worktree_id(cx),path: file.path.clone(),@@ -2236,12 +2237,11 @@ impl EditorElement {.map_or(range.context.start, |primary| primary.start);let jump_position = language::ToPoint::to_point(&jump_anchor, buffer);- IconButton::new(block_id, Icon::ArrowUpRight)- .style(ButtonStyle::Subtle)- .on_click(cx.listener_for(&self.editor, move |editor, e, cx| {- editor.jump(jump_path.clone(), jump_position, jump_anchor, cx);- }))- .tooltip(|cx| Tooltip::for_action("Jump to Buffer", &OpenExcerpts, cx))+ let jump_handler = cx.listener_for(&self.editor, move |editor, e, cx| {+ editor.jump(jump_path.clone(), jump_position, jump_anchor, cx);+ });++ jump_handler});let element = if *starts_new_buffer {@@ -2303,16 +2303,61 @@ impl EditorElement {}),),)- .children(jump_icon), // .p_x(gutter_padding)+ .children(jump_handler.map(|jump_handler| {+ IconButton::new(block_id, Icon::ArrowUpRight)+ .style(ButtonStyle::Subtle)+ .on_click(jump_handler)+ .tooltip(|cx| {+ Tooltip::for_action("Jump to Buffer", &OpenExcerpts, cx)+ })+ })), // .p_x(gutter_padding))} else {let text_style = style.text.clone();h_stack().id("collapsed context").size_full()- .bg(gpui::red())- .child("⋯")- .children(jump_icon) // .p_x(gutter_padding)+ .gap(gutter_padding)+ .child(+ h_stack()+ .justify_end()+ .flex_none()+ .w(gutter_width - gutter_padding)+ .h_full()+ .text_buffer(cx)+ .text_color(cx.theme().colors().editor_line_number)+ .child("..."),+ )+ .map(|this| {+ if let Some(jump_handler) = jump_handler {+ this.child(+ ButtonLike::new("jump to collapsed context")+ .style(ButtonStyle::Transparent)+ .full_width()+ .on_click(jump_handler)+ .tooltip(|cx| {+ Tooltip::for_action(+ "Jump to Buffer",+ &OpenExcerpts,+ cx,+ )+ })+ .child(+ div()+ .h_px()+ .w_full()+ .bg(cx.theme().colors().border_variant)+ .group_hover("", |style| {+ style.bg(cx.theme().colors().border)+ }),+ ),+ )+ } else {+ this.child(div().size_full().bg(gpui::green()))+ }+ })+ // .child("⋯")+ // .children(jump_icon) // .p_x(gutter_padding)};element.into_any()}diff --git a/crates/ui2/src/components/button/button_like.rs b/crates/ui2/src/components/button/button_like.rsindex c527e254944..6af81cae77d 100644--- a/crates/ui2/src/components/button/button_like.rs+++ b/crates/ui2/src/components/button/button_like.rs@@ -267,6 +267,7 @@ impl RenderOnce for ButtonLike {fn render(self, cx: &mut WindowContext) -> Self::Rendered {h_stack().id(self.id.clone())+ .group("").flex_none().h(self.size.height()).when_some(self.width, |this, width| this.w(width))diff --git a/crates/ui2/src/styled_ext.rs b/crates/ui2/src/styled_ext.rsindex cb224fd0fe6..e567830d6ca 100644--- a/crates/ui2/src/styled_ext.rs+++ b/crates/ui2/src/styled_ext.rs@@ -1,4 +1,6 @@use gpui::{px, Styled, WindowContext};+use settings::Settings;+use theme::ThemeSettings;use crate::prelude::*;use crate::{ElevationIndex, UITextSize};@@ -60,6 +62,18 @@ pub trait StyledExt: Styled + Sized {self.text_size(size)}+ /// The font size for buffer text.+ ///+ /// Retrieves the default font size, or the user's custom font size if set.+ ///+ /// This should only be used for text that is displayed in a buffer,+ /// or other places that text needs to match the user's buffer font size.+ fn text_buffer(self, cx: &mut WindowContext) -> Self {+ let settings = ThemeSettings::get_global(cx);++ self.text_size(settings.buffer_font_size)+ }+/// The [`Surface`](ui2::ElevationIndex::Surface) elevation level, located above the app background, is the standard level for all elements////// Sets `bg()`, `rounded_lg()`, `border()`, `border_color()`, `shadow()`