From 1acc6b462f4c671031faefe02c240ed32dcec0dd Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Mon, 27 Nov 2023 10:29:29 -0500 Subject: [PATCH] Start on completions styles --- crates/editor2/src/editor.rs | 22 +++++++++++++++++----- crates/ui2/src/components/popover.rs | 2 ++ crates/ui2/src/styled_ext.rs | 4 ++-- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/crates/editor2/src/editor.rs b/crates/editor2/src/editor.rs index 3a9a40328d2b6dc0a11cbc75004f2d9c36b865ee..a0f074221c4ba0eb2f2db2b148a59796e5ef140a 100644 --- a/crates/editor2/src/editor.rs +++ b/crates/editor2/src/editor.rs @@ -1273,6 +1273,13 @@ impl CompletionsMenu { multiline_docs.map(|div| { div.id("multiline_docs") .max_h(max_height) + .flex_1() + .px_1p5() + .py_1() + .min_w(px(260.)) + .max_w(px(640.)) + .w(px(500.)) + .text_ui() .overflow_y_scroll() // Prevent a mouse down on documentation from being propagated to the editor, // because that would move the cursor. @@ -1327,13 +1334,18 @@ impl CompletionsMenu { div() .id(mat.candidate_id) - .min_w(px(300.)) - .max_w(px(700.)) + .min_w(px(220.)) + .max_w(px(640.)) .whitespace_nowrap() .overflow_hidden() - .bg(gpui::green()) - .hover(|style| style.bg(gpui::blue())) - .when(item_ix == selected_item, |div| div.bg(gpui::red())) + .text_ui() + .px_1() + .rounded(px(4.)) + .bg(cx.theme().colors().ghost_element_background) + .hover(|style| style.bg(cx.theme().colors().ghost_element_hover)) + .when(item_ix == selected_item, |div| { + div.bg(cx.theme().colors().ghost_element_selected) + }) .on_mouse_down( MouseButton::Left, cx.listener(move |editor, event, cx| { diff --git a/crates/ui2/src/components/popover.rs b/crates/ui2/src/components/popover.rs index ac407d23353bfb65e031b651d37b639d06c0fd42..3838e40bec527fb191c6a0e187c6982dcb643c59 100644 --- a/crates/ui2/src/components/popover.rs +++ b/crates/ui2/src/components/popover.rs @@ -3,6 +3,7 @@ use gpui::{ WindowContext, }; use smallvec::SmallVec; +use theme2::ActiveTheme; use crate::{v_stack, StyledExt}; @@ -58,6 +59,7 @@ impl RenderOnce for Popover { .ml_1() .absolute() .elevation_2(cx) + .bg(cx.theme().colors().surface_background) .p_1() .child(aside), ) diff --git a/crates/ui2/src/styled_ext.rs b/crates/ui2/src/styled_ext.rs index 9e81ab19ee37b4bebb4ba6845a27b8c28498a47d..d064312c327bc5cddfc7784b3ef0793690e0da79 100644 --- a/crates/ui2/src/styled_ext.rs +++ b/crates/ui2/src/styled_ext.rs @@ -1,4 +1,4 @@ -use gpui::{Styled, WindowContext}; +use gpui::{px, Styled, WindowContext}; use theme2::ActiveTheme; use crate::{ElevationIndex, UITextSize}; @@ -6,7 +6,7 @@ use crate::{ElevationIndex, UITextSize}; fn elevated(this: E, cx: &mut WindowContext, index: ElevationIndex) -> E { this.bg(cx.theme().colors().elevated_surface_background) .z_index(index.z_index()) - .rounded_lg() + .rounded(px(8.)) .border() .border_color(cx.theme().colors().border_variant) .shadow(index.shadow())