From c86cf2c3e1464fbc07cea0d8e94b10e1b5eac07a Mon Sep 17 00:00:00 2001
From: Danilo Leal <67129314+danilo-leal@users.noreply.github.com>
Date: Tue, 17 Dec 2024 15:45:58 -0300
Subject: [PATCH] zeta: Refine visuals for the completion popover (#22142)
Most notably, trying out a different icon and adding the "Completion"
word to the side of the provider name.
Release Notes:
- N/A
---
assets/icons/zed_predict.svg | 5 ++-
crates/editor/src/code_context_menus.rs | 53 ++++++++++++-------------
2 files changed, 29 insertions(+), 29 deletions(-)
diff --git a/assets/icons/zed_predict.svg b/assets/icons/zed_predict.svg
index 6b152af0d9c61bdf342c642aa0584f8d1119c5a1..75d64a94397c3b149477163e3ef58717fe7910da 100644
--- a/assets/icons/zed_predict.svg
+++ b/assets/icons/zed_predict.svg
@@ -1,4 +1,5 @@
diff --git a/crates/editor/src/code_context_menus.rs b/crates/editor/src/code_context_menus.rs
index 9a0f2611ab64caad2511df7e12ac21ff4b0ba82c..cce6f6d7236936be11fee7f848b008a7bef7431a 100644
--- a/crates/editor/src/code_context_menus.rs
+++ b/crates/editor/src/code_context_menus.rs
@@ -14,11 +14,7 @@ use multi_buffer::{Anchor, ExcerptId};
use ordered_float::OrderedFloat;
use project::{CodeAction, Completion, TaskSourceKind};
use task::ResolvedTask;
-use ui::{
- h_flex, ActiveTheme as _, Color, FluentBuilder as _, InteractiveElement as _, IntoElement,
- Label, LabelCommon as _, LabelSize, ListItem, ParentElement as _, Popover,
- StatefulInteractiveElement as _, Styled, Toggleable as _,
-};
+use ui::{prelude::*, Color, IntoElement, ListItem, Popover, Styled};
use util::ResultExt as _;
use workspace::Workspace;
@@ -425,8 +421,10 @@ impl CompletionsMenu {
CompletionEntry::InlineCompletionHint(hint) => Some(match &hint.text {
InlineCompletionText::Edit { text, highlights } => div()
.my_1()
- .rounded_md()
+ .rounded(px(6.))
.bg(cx.theme().colors().editor_background)
+ .border_1()
+ .border_color(cx.theme().colors().border_variant)
.child(
gpui::StyledText::new(text.clone())
.with_highlights(&style.text, highlights.clone()),
@@ -451,9 +449,8 @@ impl CompletionsMenu {
.flex_1()
.px_1p5()
.py_1()
- .min_w(px(260.))
.max_w(px(640.))
- .w(px(500.))
+ .w(px(450.))
.overflow_y_scroll()
.occlude()
});
@@ -513,6 +510,7 @@ impl CompletionsMenu {
(range, highlight)
}),
);
+
let completion_label =
StyledText::new(completion.label.text.clone())
.with_highlights(&style.text, highlights);
@@ -559,25 +557,26 @@ impl CompletionsMenu {
CompletionEntry::InlineCompletionHint(InlineCompletionMenuHint {
provider_name,
..
- }) => div()
- .min_w(px(250.))
- .max_w(px(500.))
- .pb_1()
- .border_b_1()
- .border_color(cx.theme().colors().border_variant)
- .child(
- ListItem::new("inline-completion")
- .inset(true)
- .toggle_state(item_ix == selected_item)
- .on_click(cx.listener(move |editor, _event, cx| {
- cx.stop_propagation();
- editor.accept_inline_completion(
- &AcceptInlineCompletion {},
- cx,
- );
- }))
- .child(Label::new(SharedString::new_static(provider_name))),
- ),
+ }) => div().min_w(px(250.)).max_w(px(500.)).child(
+ ListItem::new("inline-completion")
+ .inset(true)
+ .toggle_state(item_ix == selected_item)
+ .start_slot(Icon::new(IconName::ZedPredict))
+ .child(
+ StyledText::new(format!(
+ "{} Completion",
+ SharedString::new_static(provider_name)
+ ))
+ .with_highlights(&style.text, None),
+ )
+ .on_click(cx.listener(move |editor, _event, cx| {
+ cx.stop_propagation();
+ editor.accept_inline_completion(
+ &AcceptInlineCompletion {},
+ cx,
+ );
+ })),
+ ),
}
})
.collect()