Merge branch 'main' into ollama-inline-completions
# Conflicts: # Cargo.lock
This commit is contained in:
commit
719c666a70
734 changed files with 51232 additions and 15633 deletions
|
@ -41,9 +41,16 @@ use zed_actions::OpenBrowser;
|
|||
use zed_llm_client::UsageLimit;
|
||||
use zeta::RateCompletions;
|
||||
|
||||
actions!(edit_prediction, [ToggleMenu]);
|
||||
actions!(
|
||||
edit_prediction,
|
||||
[
|
||||
/// Toggles the inline completion menu.
|
||||
ToggleMenu
|
||||
]
|
||||
);
|
||||
|
||||
const COPILOT_SETTINGS_URL: &str = "https://github.com/settings/copilot";
|
||||
const PRIVACY_DOCS: &str = "https://zed.dev/docs/ai/privacy-and-security";
|
||||
|
||||
struct CopilotErrorToast;
|
||||
|
||||
|
@ -191,13 +198,13 @@ impl Render for InlineCompletionButton {
|
|||
cx.open_url(activate_url.as_str())
|
||||
})
|
||||
.entry(
|
||||
"Use Copilot",
|
||||
"Use Zed AI",
|
||||
None,
|
||||
move |_, cx| {
|
||||
set_completion_provider(
|
||||
fs.clone(),
|
||||
cx,
|
||||
EditPredictionProvider::Copilot,
|
||||
EditPredictionProvider::Zed,
|
||||
)
|
||||
},
|
||||
)
|
||||
|
@ -237,22 +244,13 @@ impl Render for InlineCompletionButton {
|
|||
IconName::ZedPredictDisabled
|
||||
};
|
||||
|
||||
let current_user_terms_accepted =
|
||||
self.user_store.read(cx).current_user_has_accepted_terms();
|
||||
let has_subscription = self.user_store.read(cx).current_plan().is_some()
|
||||
&& self.user_store.read(cx).subscription_period().is_some();
|
||||
|
||||
if !has_subscription || !current_user_terms_accepted.unwrap_or(false) {
|
||||
let signed_in = current_user_terms_accepted.is_some();
|
||||
let tooltip_meta = if signed_in {
|
||||
if has_subscription {
|
||||
"Read Terms of Service"
|
||||
} else {
|
||||
"Choose a Plan"
|
||||
}
|
||||
} else {
|
||||
"Sign in to use"
|
||||
};
|
||||
if zeta::should_show_upsell_modal(&self.user_store, cx) {
|
||||
let tooltip_meta =
|
||||
match self.user_store.read(cx).current_user_has_accepted_terms() {
|
||||
Some(true) => "Choose a Plan",
|
||||
Some(false) => "Accept the Terms of Service",
|
||||
None => "Sign In",
|
||||
};
|
||||
|
||||
return div().child(
|
||||
IconButton::new("zed-predict-pending-button", zeta_icon)
|
||||
|
@ -436,15 +434,16 @@ impl InlineCompletionButton {
|
|||
) -> Entity<ContextMenu> {
|
||||
let fs = self.fs.clone();
|
||||
ContextMenu::build(window, cx, |menu, _, _| {
|
||||
menu.entry("Sign In", None, copilot::initiate_sign_in)
|
||||
menu.entry("Sign In to Copilot", None, copilot::initiate_sign_in)
|
||||
.entry("Disable Copilot", None, {
|
||||
let fs = fs.clone();
|
||||
move |_window, cx| hide_copilot(fs.clone(), cx)
|
||||
})
|
||||
.entry("Use Supermaven", None, {
|
||||
.separator()
|
||||
.entry("Use Zed AI", None, {
|
||||
let fs = fs.clone();
|
||||
move |_window, cx| {
|
||||
set_completion_provider(fs.clone(), cx, EditPredictionProvider::Supermaven)
|
||||
set_completion_provider(fs.clone(), cx, EditPredictionProvider::Zed)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
@ -554,7 +553,7 @@ impl InlineCompletionButton {
|
|||
);
|
||||
}
|
||||
|
||||
menu = menu.separator().header("Privacy Settings");
|
||||
menu = menu.separator().header("Privacy");
|
||||
if let Some(provider) = &self.edit_prediction_provider {
|
||||
let data_collection = provider.data_collection_state(cx);
|
||||
if data_collection.is_supported() {
|
||||
|
@ -605,13 +604,15 @@ impl InlineCompletionButton {
|
|||
.child(
|
||||
Label::new(indoc!{
|
||||
"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. \
|
||||
Files with sensitive data and secrets are excluded by default."
|
||||
})
|
||||
)
|
||||
.child(
|
||||
h_flex()
|
||||
.items_start()
|
||||
.pt_2()
|
||||
.pr_1()
|
||||
.flex_1()
|
||||
.gap_1p5()
|
||||
.border_t_1()
|
||||
|
@ -671,6 +672,13 @@ impl InlineCompletionButton {
|
|||
.detach_and_log_err(cx);
|
||||
}
|
||||
}),
|
||||
).item(
|
||||
ContextMenuEntry::new("View Documentation")
|
||||
.icon(IconName::FileGeneric)
|
||||
.icon_color(Color::Muted)
|
||||
.handler(move |_, cx| {
|
||||
cx.open_url(PRIVACY_DOCS);
|
||||
})
|
||||
);
|
||||
|
||||
if !self.editor_enabled.unwrap_or(true) {
|
||||
|
@ -708,6 +716,13 @@ impl InlineCompletionButton {
|
|||
) -> Entity<ContextMenu> {
|
||||
ContextMenu::build(window, cx, |menu, window, cx| {
|
||||
self.build_language_settings_menu(menu, window, cx)
|
||||
.separator()
|
||||
.entry("Use Zed AI instead", None, {
|
||||
let fs = self.fs.clone();
|
||||
move |_window, cx| {
|
||||
set_completion_provider(fs.clone(), cx, EditPredictionProvider::Zed)
|
||||
}
|
||||
})
|
||||
.separator()
|
||||
.link(
|
||||
"Go to Copilot Settings",
|
||||
|
@ -786,44 +801,24 @@ impl InlineCompletionButton {
|
|||
menu = menu
|
||||
.custom_entry(
|
||||
|_window, _cx| {
|
||||
h_flex()
|
||||
.gap_1()
|
||||
.child(
|
||||
Icon::new(IconName::Warning)
|
||||
.size(IconSize::Small)
|
||||
.color(Color::Warning),
|
||||
)
|
||||
.child(
|
||||
Label::new("Your GitHub account is less than 30 days old")
|
||||
.size(LabelSize::Small)
|
||||
.color(Color::Warning),
|
||||
)
|
||||
Label::new("Your GitHub account is less than 30 days old.")
|
||||
.size(LabelSize::Small)
|
||||
.color(Color::Warning)
|
||||
.into_any_element()
|
||||
},
|
||||
|_window, cx| cx.open_url(&zed_urls::account_url(cx)),
|
||||
)
|
||||
.entry(
|
||||
"You need to upgrade to Zed Pro or contact us.",
|
||||
None,
|
||||
|_window, cx| cx.open_url(&zed_urls::account_url(cx)),
|
||||
)
|
||||
.entry("Upgrade to Zed Pro or contact us.", None, |_window, cx| {
|
||||
cx.open_url(&zed_urls::account_url(cx))
|
||||
})
|
||||
.separator();
|
||||
} else if self.user_store.read(cx).has_overdue_invoices() {
|
||||
menu = menu
|
||||
.custom_entry(
|
||||
|_window, _cx| {
|
||||
h_flex()
|
||||
.gap_1()
|
||||
.child(
|
||||
Icon::new(IconName::Warning)
|
||||
.size(IconSize::Small)
|
||||
.color(Color::Warning),
|
||||
)
|
||||
.child(
|
||||
Label::new("You have an outstanding invoice")
|
||||
.size(LabelSize::Small)
|
||||
.color(Color::Warning),
|
||||
)
|
||||
Label::new("You have an outstanding invoice")
|
||||
.size(LabelSize::Small)
|
||||
.color(Color::Warning)
|
||||
.into_any_element()
|
||||
},
|
||||
|_window, cx| {
|
||||
|
@ -1026,10 +1021,6 @@ impl InlineCompletionButton {
|
|||
|
||||
cx.notify();
|
||||
}
|
||||
|
||||
pub fn toggle_menu(&mut self, window: &mut Window, cx: &mut Context<Self>) {
|
||||
self.popover_menu_handle.toggle(window, cx);
|
||||
}
|
||||
}
|
||||
|
||||
impl StatusItemView for InlineCompletionButton {
|
||||
|
@ -1164,6 +1155,7 @@ fn toggle_show_inline_completions_for_language(
|
|||
all_language_settings(None, cx).show_edit_predictions(Some(&language), cx);
|
||||
update_settings_file::<AllLanguageSettings>(fs, cx, move |file, _| {
|
||||
file.languages
|
||||
.0
|
||||
.entry(language.name())
|
||||
.or_default()
|
||||
.show_edit_predictions = Some(!show_edit_predictions);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue