Set edit predictions to default to the Zed provider (#27394)
Release Notes: - Changed the default edit prediction provider from Copilot to Zed
This commit is contained in:
parent
ffa736e566
commit
42f01cc903
4 changed files with 15 additions and 43 deletions
|
@ -25,7 +25,7 @@
|
||||||
// Features that can be globally enabled or disabled
|
// Features that can be globally enabled or disabled
|
||||||
"features": {
|
"features": {
|
||||||
// Which edit prediction provider to use.
|
// Which edit prediction provider to use.
|
||||||
"edit_prediction_provider": "copilot"
|
"edit_prediction_provider": "zed"
|
||||||
},
|
},
|
||||||
// The name of a font to use for rendering text in the editor
|
// The name of a font to use for rendering text in the editor
|
||||||
"buffer_font_family": "Zed Plex Mono",
|
"buffer_font_family": "Zed Plex Mono",
|
||||||
|
|
|
@ -6,9 +6,7 @@ use editor::{
|
||||||
scroll::Autoscroll,
|
scroll::Autoscroll,
|
||||||
Editor,
|
Editor,
|
||||||
};
|
};
|
||||||
use feature_flags::{
|
use feature_flags::{FeatureFlagAppExt, PredictEditsRateCompletionsFeatureFlag};
|
||||||
FeatureFlagAppExt, PredictEditsFeatureFlag, PredictEditsRateCompletionsFeatureFlag,
|
|
||||||
};
|
|
||||||
use fs::Fs;
|
use fs::Fs;
|
||||||
use gpui::{
|
use gpui::{
|
||||||
actions, div, pulsating_between, Action, Animation, AnimationExt, App, AsyncWindowContext,
|
actions, div, pulsating_between, Action, Animation, AnimationExt, App, AsyncWindowContext,
|
||||||
|
@ -232,10 +230,6 @@ impl Render for InlineCompletionButton {
|
||||||
}
|
}
|
||||||
|
|
||||||
EditPredictionProvider::Zed => {
|
EditPredictionProvider::Zed => {
|
||||||
if !cx.has_flag::<PredictEditsFeatureFlag>() {
|
|
||||||
return div();
|
|
||||||
}
|
|
||||||
|
|
||||||
let enabled = self.editor_enabled.unwrap_or(true);
|
let enabled = self.editor_enabled.unwrap_or(true);
|
||||||
|
|
||||||
let zeta_icon = if enabled {
|
let zeta_icon = if enabled {
|
||||||
|
@ -258,7 +252,7 @@ impl Render for InlineCompletionButton {
|
||||||
return div().child(
|
return div().child(
|
||||||
IconButton::new("zed-predict-pending-button", zeta_icon)
|
IconButton::new("zed-predict-pending-button", zeta_icon)
|
||||||
.shape(IconButtonShape::Square)
|
.shape(IconButtonShape::Square)
|
||||||
.indicator(Indicator::dot().color(Color::Error))
|
.indicator(Indicator::dot().color(Color::Muted))
|
||||||
.indicator_border_color(Some(cx.theme().colors().status_bar_background))
|
.indicator_border_color(Some(cx.theme().colors().status_bar_background))
|
||||||
.tooltip(move |window, cx| {
|
.tooltip(move |window, cx| {
|
||||||
Tooltip::with_meta(
|
Tooltip::with_meta(
|
||||||
|
|
|
@ -2,7 +2,6 @@ use client::{Client, UserStore};
|
||||||
use collections::HashMap;
|
use collections::HashMap;
|
||||||
use copilot::{Copilot, CopilotCompletionProvider};
|
use copilot::{Copilot, CopilotCompletionProvider};
|
||||||
use editor::{Editor, EditorMode};
|
use editor::{Editor, EditorMode};
|
||||||
use feature_flags::{FeatureFlagAppExt, PredictEditsFeatureFlag};
|
|
||||||
use gpui::{AnyWindowHandle, App, AppContext as _, Context, Entity, WeakEntity};
|
use gpui::{AnyWindowHandle, App, AppContext as _, Context, Entity, WeakEntity};
|
||||||
use language::language_settings::{all_language_settings, EditPredictionProvider};
|
use language::language_settings::{all_language_settings, EditPredictionProvider};
|
||||||
use settings::SettingsStore;
|
use settings::SettingsStore;
|
||||||
|
@ -71,23 +70,8 @@ pub fn init(client: Arc<Client>, user_store: Entity<UserStore>, cx: &mut App) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if cx.has_flag::<PredictEditsFeatureFlag>() {
|
cx.on_action(clear_zeta_edit_history);
|
||||||
cx.on_action(clear_zeta_edit_history);
|
assign_edit_prediction_providers(&editors, provider, &client, user_store.clone(), cx);
|
||||||
}
|
|
||||||
|
|
||||||
cx.observe_flag::<PredictEditsFeatureFlag, _>({
|
|
||||||
let editors = editors.clone();
|
|
||||||
let client = client.clone();
|
|
||||||
let user_store = user_store.clone();
|
|
||||||
move |active, cx| {
|
|
||||||
let provider = all_language_settings(None, cx).edit_predictions.provider;
|
|
||||||
assign_edit_prediction_providers(&editors, provider, &client, user_store.clone(), cx);
|
|
||||||
if active && !cx.is_action_available(&zeta::ClearHistory) {
|
|
||||||
cx.on_action(clear_zeta_edit_history);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.detach();
|
|
||||||
|
|
||||||
cx.observe_global::<SettingsStore>({
|
cx.observe_global::<SettingsStore>({
|
||||||
let editors = editors.clone();
|
let editors = editors.clone();
|
||||||
|
@ -249,9 +233,7 @@ fn assign_edit_prediction_provider(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EditPredictionProvider::Zed => {
|
EditPredictionProvider::Zed => {
|
||||||
if cx.has_flag::<PredictEditsFeatureFlag>()
|
if client.status().borrow().is_connected() {
|
||||||
|| (cfg!(debug_assertions) && client.status().borrow().is_connected())
|
|
||||||
{
|
|
||||||
let mut worktree = None;
|
let mut worktree = None;
|
||||||
|
|
||||||
if let Some(buffer) = &singleton_buffer {
|
if let Some(buffer) = &singleton_buffer {
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
use std::any::{Any, TypeId};
|
use std::any::{Any, TypeId};
|
||||||
|
|
||||||
use command_palette_hooks::CommandPaletteFilter;
|
use command_palette_hooks::CommandPaletteFilter;
|
||||||
use feature_flags::{
|
use feature_flags::{FeatureFlagAppExt as _, PredictEditsRateCompletionsFeatureFlag};
|
||||||
FeatureFlagAppExt as _, PredictEditsFeatureFlag, PredictEditsRateCompletionsFeatureFlag,
|
|
||||||
};
|
|
||||||
use gpui::actions;
|
use gpui::actions;
|
||||||
use language::language_settings::{AllLanguageSettings, EditPredictionProvider};
|
use language::language_settings::{AllLanguageSettings, EditPredictionProvider};
|
||||||
use settings::update_settings_file;
|
use settings::update_settings_file;
|
||||||
|
@ -24,16 +22,14 @@ pub fn init(cx: &mut App) {
|
||||||
|
|
||||||
workspace.register_action(
|
workspace.register_action(
|
||||||
move |workspace, _: &zed_actions::OpenZedPredictOnboarding, window, cx| {
|
move |workspace, _: &zed_actions::OpenZedPredictOnboarding, window, cx| {
|
||||||
if cx.has_flag::<PredictEditsFeatureFlag>() {
|
ZedPredictModal::toggle(
|
||||||
ZedPredictModal::toggle(
|
workspace,
|
||||||
workspace,
|
workspace.user_store().clone(),
|
||||||
workspace.user_store().clone(),
|
workspace.client().clone(),
|
||||||
workspace.client().clone(),
|
workspace.app_state().fs.clone(),
|
||||||
workspace.app_state().fs.clone(),
|
window,
|
||||||
window,
|
cx,
|
||||||
cx,
|
)
|
||||||
)
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue