edit predictions: Improve copywriting (#24689)
This commit is contained in:
parent
f5fd3d98ad
commit
2e7a89c5e3
4 changed files with 55 additions and 31 deletions
|
@ -406,7 +406,7 @@ impl InlineCompletionButton {
|
|||
|
||||
if let Some(editor_focus_handle) = self.editor_focus_handle.clone() {
|
||||
menu = menu.toggleable_entry(
|
||||
"This File",
|
||||
"This Buffer",
|
||||
self.editor_show_predictions,
|
||||
IconPosition::Start,
|
||||
Some(Box::new(ToggleEditPrediction)),
|
||||
|
@ -451,33 +451,41 @@ impl InlineCompletionButton {
|
|||
let enabled = data_collection.is_enabled();
|
||||
let is_open_source = data_collection.is_project_open_source();
|
||||
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(
|
||||
ContextMenuEntry::new("Share Training Data")
|
||||
ContextMenuEntry::new("Training Data Collection")
|
||||
.toggleable(IconPosition::Start, data_collection.is_enabled())
|
||||
.icon_color(if is_open_source && is_collecting {
|
||||
Color::Success
|
||||
} else {
|
||||
Color::Accent
|
||||
})
|
||||
.icon(icon_name)
|
||||
.icon_color(icon_color)
|
||||
.documentation_aside(move |cx| {
|
||||
let (msg, label_color, icon_name, icon_color) = match (is_open_source, is_collecting) {
|
||||
(true, true) => (
|
||||
"Project identified as open-source, and you're sharing data.",
|
||||
"Project identified as open source, and you're sharing data.",
|
||||
Color::Default,
|
||||
IconName::Check,
|
||||
Color::Success,
|
||||
),
|
||||
(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,
|
||||
IconName::XCircle,
|
||||
IconName::Close,
|
||||
Color::Muted,
|
||||
),
|
||||
(false, _) => (
|
||||
"Project not identified as open-source. No data captured.",
|
||||
(false, true) => (
|
||||
"Project not identified as open source. No data captured.",
|
||||
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,
|
||||
),
|
||||
};
|
||||
|
@ -485,7 +493,7 @@ impl InlineCompletionButton {
|
|||
.gap_2()
|
||||
.child(
|
||||
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."
|
||||
})
|
||||
)
|
||||
|
@ -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,
|
||||
};
|
||||
menu = menu.separator().toggleable_entry(
|
||||
"Eager Preview",
|
||||
"Eager Preview Mode",
|
||||
is_eager_preview_enabled,
|
||||
IconPosition::Start,
|
||||
None,
|
||||
|
|
|
@ -598,6 +598,7 @@ impl Render for ContextMenu {
|
|||
}) => {
|
||||
let handler = handler.clone();
|
||||
let menu = cx.entity().downgrade();
|
||||
|
||||
let icon_color = if *disabled {
|
||||
Color::Muted
|
||||
} else if toggle.is_some() {
|
||||
|
@ -605,16 +606,18 @@ impl Render for ContextMenu {
|
|||
} else {
|
||||
icon_color.unwrap_or(Color::Default)
|
||||
};
|
||||
|
||||
let label_color = if *disabled {
|
||||
Color::Muted
|
||||
} else {
|
||||
Color::Default
|
||||
};
|
||||
|
||||
let label_element = if let Some(icon_name) = icon {
|
||||
h_flex()
|
||||
.gap_1p5()
|
||||
.when(
|
||||
*icon_position == IconPosition::Start,
|
||||
*icon_position == IconPosition::Start && toggle.is_none(),
|
||||
|flex| {
|
||||
flex.child(
|
||||
Icon::new(*icon_name)
|
||||
|
@ -643,8 +646,10 @@ impl Render for ContextMenu {
|
|||
.color(label_color)
|
||||
.into_any_element()
|
||||
};
|
||||
|
||||
let documentation_aside_callback =
|
||||
documentation_aside.clone();
|
||||
|
||||
div()
|
||||
.id(("context-menu-child", ix))
|
||||
.when_some(
|
||||
|
@ -675,7 +680,7 @@ impl Render for ContextMenu {
|
|||
|list_item, (position, toggled)| {
|
||||
let contents =
|
||||
div().flex_none().child(
|
||||
Icon::new(IconName::Check)
|
||||
Icon::new(icon.unwrap_or(IconName::Check))
|
||||
.color(icon_color)
|
||||
.size(*icon_size)
|
||||
)
|
||||
|
@ -778,7 +783,7 @@ impl Render for ContextMenu {
|
|||
}
|
||||
}
|
||||
},
|
||||
))),
|
||||
)))
|
||||
),
|
||||
)
|
||||
}
|
||||
|
|
|
@ -168,7 +168,7 @@ impl Render for ZedPredictModal {
|
|||
.id("edit-prediction-onboarding")
|
||||
.key_context("ZedPredictModal")
|
||||
.relative()
|
||||
.w(px(440.))
|
||||
.w(px(480.))
|
||||
.h_full()
|
||||
.max_h(max_height)
|
||||
.p_4()
|
||||
|
@ -201,7 +201,7 @@ impl Render for ZedPredictModal {
|
|||
svg()
|
||||
.path("icons/zed_predict_bg.svg")
|
||||
.text_color(cx.theme().colors().icon_disabled)
|
||||
.w(px(418.))
|
||||
.w(px(460.))
|
||||
.h(px(128.))
|
||||
.overflow_hidden(),
|
||||
),
|
||||
|
@ -354,7 +354,7 @@ impl Render for ZedPredictModal {
|
|||
"training-data-checkbox",
|
||||
self.data_collection_opted_in.into(),
|
||||
)
|
||||
.label("Optionally share training data (OSS-only).")
|
||||
.label("Open source repos: optionally share training data.")
|
||||
.fill()
|
||||
.on_click(cx.listener(
|
||||
move |this, state, _window, cx| {
|
||||
|
@ -391,26 +391,27 @@ impl Render for ZedPredictModal {
|
|||
.border_color(cx.theme().colors().border_variant)
|
||||
.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()
|
||||
)
|
||||
)
|
||||
.child(info_item(
|
||||
"We ask this exclusively for open-source projects.",
|
||||
"We ask this exclusively for open source projects.",
|
||||
))
|
||||
.child(info_item(
|
||||
"Zed automatically detects if your project is open-source.",
|
||||
))
|
||||
.child(info_item(
|
||||
"This setting is valid for all OSS projects you open in Zed.",
|
||||
"Zed automatically detects if your project is open source.",
|
||||
))
|
||||
.child(info_item("Toggle it anytime via the status bar menu."))
|
||||
.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()
|
||||
.w_full()
|
||||
.flex_wrap()
|
||||
.child(label_item("by default via the"))
|
||||
.child(label_item("via the"))
|
||||
.child(
|
||||
Button::new("doc-link", "disabled_globs").on_click(
|
||||
cx.listener(Self::inline_completions_doc),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue