edit predictions: Improve copywriting (#24689)

This commit is contained in:
Danilo Leal 2025-02-11 21:43:48 -03:00 committed by GitHub
parent f5fd3d98ad
commit 2e7a89c5e3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 55 additions and 31 deletions

View file

@ -1,6 +1,6 @@
<svg width="440" height="128" xmlns="http://www.w3.org/2000/svg"> <svg width="480" height="128" xmlns="http://www.w3.org/2000/svg">
<defs> <defs>
<pattern id="tilePattern" width="22" height="22" patternUnits="userSpaceOnUse"> <pattern id="tilePattern" width="23" height="23" patternUnits="userSpaceOnUse">
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"> <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M12 5L14 8L12 11" stroke="black" stroke-width="1.5"/> <path d="M12 5L14 8L12 11" stroke="black" stroke-width="1.5"/>
<path d="M10 6.5L11 8L10 9.5" stroke="black" stroke-width="1.5"/> <path d="M10 6.5L11 8L10 9.5" stroke="black" stroke-width="1.5"/>

Before

Width:  |  Height:  |  Size: 971 B

After

Width:  |  Height:  |  Size: 971 B

Before After
Before After

View file

@ -406,7 +406,7 @@ impl InlineCompletionButton {
if let Some(editor_focus_handle) = self.editor_focus_handle.clone() { if let Some(editor_focus_handle) = self.editor_focus_handle.clone() {
menu = menu.toggleable_entry( menu = menu.toggleable_entry(
"This File", "This Buffer",
self.editor_show_predictions, self.editor_show_predictions,
IconPosition::Start, IconPosition::Start,
Some(Box::new(ToggleEditPrediction)), Some(Box::new(ToggleEditPrediction)),
@ -451,33 +451,41 @@ impl InlineCompletionButton {
let enabled = data_collection.is_enabled(); let enabled = data_collection.is_enabled();
let is_open_source = data_collection.is_project_open_source(); let is_open_source = data_collection.is_project_open_source();
let is_collecting = data_collection.is_enabled(); let is_collecting = data_collection.is_enabled();
let (icon_name, icon_color) = if is_open_source && is_collecting {
(IconName::Check, Color::Success)
} else {
(IconName::Check, Color::Accent)
};
menu = menu.item( menu = menu.item(
ContextMenuEntry::new("Share Training Data") ContextMenuEntry::new("Training Data Collection")
.toggleable(IconPosition::Start, data_collection.is_enabled()) .toggleable(IconPosition::Start, data_collection.is_enabled())
.icon_color(if is_open_source && is_collecting { .icon(icon_name)
Color::Success .icon_color(icon_color)
} else {
Color::Accent
})
.documentation_aside(move |cx| { .documentation_aside(move |cx| {
let (msg, label_color, icon_name, icon_color) = match (is_open_source, is_collecting) { let (msg, label_color, icon_name, icon_color) = match (is_open_source, is_collecting) {
(true, true) => ( (true, true) => (
"Project identified as open-source, and you're sharing data.", "Project identified as open source, and you're sharing data.",
Color::Default, Color::Default,
IconName::Check, IconName::Check,
Color::Success, Color::Success,
), ),
(true, false) => ( (true, false) => (
"Project identified as open-source, but you're not sharing data.", "Project identified as open source, but you're not sharing data.",
Color::Muted, Color::Muted,
IconName::XCircle, IconName::Close,
Color::Muted, Color::Muted,
), ),
(false, _) => ( (false, true) => (
"Project not identified as open-source. No data captured.", "Project not identified as open source. No data captured.",
Color::Muted, Color::Muted,
IconName::XCircle, IconName::Close,
Color::Muted,
),
(false, false) => (
"Project not identified as open source, and setting turned off.",
Color::Muted,
IconName::Close,
Color::Muted, Color::Muted,
), ),
}; };
@ -485,7 +493,7 @@ impl InlineCompletionButton {
.gap_2() .gap_2()
.child( .child(
Label::new(indoc!{ Label::new(indoc!{
"Help us improve our open model by sharing data from open source repositories. \ "Help us improve our open dataset model by sharing data from open source repositories. \
Zed must detect a license file in your repo for this setting to take effect." Zed must detect a license file in your repo for this setting to take effect."
}) })
) )
@ -516,6 +524,16 @@ impl InlineCompletionButton {
} }
}) })
); );
if is_collecting && !is_open_source {
menu = menu.item(
ContextMenuEntry::new("No data captured.")
.disabled(true)
.icon(IconName::Close)
.icon_color(Color::Error)
.icon_size(IconSize::Small),
);
}
} }
} }
@ -556,7 +574,7 @@ impl InlineCompletionButton {
language::EditPredictionsMode::EagerPreview => true, language::EditPredictionsMode::EagerPreview => true,
}; };
menu = menu.separator().toggleable_entry( menu = menu.separator().toggleable_entry(
"Eager Preview", "Eager Preview Mode",
is_eager_preview_enabled, is_eager_preview_enabled,
IconPosition::Start, IconPosition::Start,
None, None,

View file

@ -598,6 +598,7 @@ impl Render for ContextMenu {
}) => { }) => {
let handler = handler.clone(); let handler = handler.clone();
let menu = cx.entity().downgrade(); let menu = cx.entity().downgrade();
let icon_color = if *disabled { let icon_color = if *disabled {
Color::Muted Color::Muted
} else if toggle.is_some() { } else if toggle.is_some() {
@ -605,16 +606,18 @@ impl Render for ContextMenu {
} else { } else {
icon_color.unwrap_or(Color::Default) icon_color.unwrap_or(Color::Default)
}; };
let label_color = if *disabled { let label_color = if *disabled {
Color::Muted Color::Muted
} else { } else {
Color::Default Color::Default
}; };
let label_element = if let Some(icon_name) = icon { let label_element = if let Some(icon_name) = icon {
h_flex() h_flex()
.gap_1p5() .gap_1p5()
.when( .when(
*icon_position == IconPosition::Start, *icon_position == IconPosition::Start && toggle.is_none(),
|flex| { |flex| {
flex.child( flex.child(
Icon::new(*icon_name) Icon::new(*icon_name)
@ -643,8 +646,10 @@ impl Render for ContextMenu {
.color(label_color) .color(label_color)
.into_any_element() .into_any_element()
}; };
let documentation_aside_callback = let documentation_aside_callback =
documentation_aside.clone(); documentation_aside.clone();
div() div()
.id(("context-menu-child", ix)) .id(("context-menu-child", ix))
.when_some( .when_some(
@ -675,7 +680,7 @@ impl Render for ContextMenu {
|list_item, (position, toggled)| { |list_item, (position, toggled)| {
let contents = let contents =
div().flex_none().child( div().flex_none().child(
Icon::new(IconName::Check) Icon::new(icon.unwrap_or(IconName::Check))
.color(icon_color) .color(icon_color)
.size(*icon_size) .size(*icon_size)
) )
@ -778,7 +783,7 @@ impl Render for ContextMenu {
} }
} }
}, },
))), )))
), ),
) )
} }

View file

@ -168,7 +168,7 @@ impl Render for ZedPredictModal {
.id("edit-prediction-onboarding") .id("edit-prediction-onboarding")
.key_context("ZedPredictModal") .key_context("ZedPredictModal")
.relative() .relative()
.w(px(440.)) .w(px(480.))
.h_full() .h_full()
.max_h(max_height) .max_h(max_height)
.p_4() .p_4()
@ -201,7 +201,7 @@ impl Render for ZedPredictModal {
svg() svg()
.path("icons/zed_predict_bg.svg") .path("icons/zed_predict_bg.svg")
.text_color(cx.theme().colors().icon_disabled) .text_color(cx.theme().colors().icon_disabled)
.w(px(418.)) .w(px(460.))
.h(px(128.)) .h(px(128.))
.overflow_hidden(), .overflow_hidden(),
), ),
@ -354,7 +354,7 @@ impl Render for ZedPredictModal {
"training-data-checkbox", "training-data-checkbox",
self.data_collection_opted_in.into(), self.data_collection_opted_in.into(),
) )
.label("Optionally share training data (OSS-only).") .label("Open source repos: optionally share training data.")
.fill() .fill()
.on_click(cx.listener( .on_click(cx.listener(
move |this, state, _window, cx| { move |this, state, _window, cx| {
@ -391,26 +391,27 @@ impl Render for ZedPredictModal {
.border_color(cx.theme().colors().border_variant) .border_color(cx.theme().colors().border_variant)
.child( .child(
div().child( div().child(
Label::new("To improve edit predictions, help fine-tune Zed's model by sharing data from the open-source projects you work on.") Label::new("To improve edit predictions, please consider contributing to our open dataset based on your interactions within open source repositories.")
.mb_1() .mb_1()
) )
) )
.child(info_item( .child(info_item(
"We ask this exclusively for open-source projects.", "We ask this exclusively for open source projects.",
)) ))
.child(info_item( .child(info_item(
"Zed automatically detects if your project is open-source.", "Zed automatically detects if your project is open source.",
))
.child(info_item(
"This setting is valid for all OSS projects you open in Zed.",
)) ))
.child(info_item("Toggle it anytime via the status bar menu.")) .child(info_item("Toggle it anytime via the status bar menu."))
.child(multiline_info_item( .child(multiline_info_item(
"Files with sensitive data, like `.env`, are excluded", "If turned on, this setting is valid for all open source projects",
label_item("you open in Zed.")
))
.child(multiline_info_item(
"Files with sensitive data, like `.env`, are excluded by default",
h_flex() h_flex()
.w_full() .w_full()
.flex_wrap() .flex_wrap()
.child(label_item("by default via the")) .child(label_item("via the"))
.child( .child(
Button::new("doc-link", "disabled_globs").on_click( Button::new("doc-link", "disabled_globs").on_click(
cx.listener(Self::inline_completions_doc), cx.listener(Self::inline_completions_doc),