{
let keybind = self.render_edit_prediction_accept_keybind(window, cx);
let has_keybind = keybind.is_some();
+ let icons = Self::get_prediction_provider_icons(&self.edit_prediction_provider, cx);
let file_name = snapshot
.file()
@@ -9802,7 +9804,7 @@ impl Editor {
el.bg(status_colors.error_background)
.border_color(status_colors.error.opacity(0.6))
.pl_2()
- .child(Icon::new(IconName::ZedPredictError).color(Color::Error))
+ .child(Icon::new(icons.error).color(Color::Error))
.cursor_default()
.hoverable_tooltip(move |_window, cx| {
cx.new(|_| MissingEditPredictionKeybindingTooltip).into()
@@ -9844,16 +9846,13 @@ impl Editor {
let editor_bg_color = cx.theme().colors().editor_background;
editor_bg_color.blend(accent_color.opacity(0.6))
}
- fn get_prediction_provider_icon_name(
+ fn get_prediction_provider_icons(
provider: &Option
,
- ) -> IconName {
+ cx: &App,
+ ) -> edit_prediction_types::EditPredictionIconSet {
match provider {
- Some(provider) => match provider.provider.name() {
- "copilot" => IconName::Copilot,
- "supermaven" => IconName::Supermaven,
- _ => IconName::ZedPredict,
- },
- None => IconName::ZedPredict,
+ Some(provider) => provider.provider.icons(cx),
+ None => edit_prediction_types::EditPredictionIconSet::new(IconName::ZedPredict),
}
}
@@ -9868,7 +9867,7 @@ impl Editor {
cx: &mut Context,
) -> Option {
let provider = self.edit_prediction_provider.as_ref()?;
- let provider_icon = Self::get_prediction_provider_icon_name(&self.edit_prediction_provider);
+ let icons = Self::get_prediction_provider_icons(&self.edit_prediction_provider, cx);
let is_refreshing = provider.provider.is_refreshing(cx);
@@ -9898,16 +9897,16 @@ impl Editor {
use text::ToPoint as _;
if target.text_anchor.to_point(snapshot).row > cursor_point.row
{
- Icon::new(IconName::ZedPredictDown)
+ Icon::new(icons.down)
} else {
- Icon::new(IconName::ZedPredictUp)
+ Icon::new(icons.up)
}
}
EditPrediction::MoveOutside { .. } => {
// TODO [zeta2] custom icon for external jump?
- Icon::new(provider_icon)
+ Icon::new(icons.base)
}
- EditPrediction::Edit { .. } => Icon::new(provider_icon),
+ EditPrediction::Edit { .. } => Icon::new(icons.base),
}))
.child(
h_flex()
@@ -9974,11 +9973,11 @@ impl Editor {
cx,
)?,
- None => pending_completion_container(provider_icon)
+ None => pending_completion_container(icons.base)
.child(Label::new("...").size(LabelSize::Small)),
},
- None => pending_completion_container(provider_icon)
+ None => pending_completion_container(icons.base)
.child(Label::new("...").size(LabelSize::Small)),
};
@@ -10088,6 +10087,8 @@ impl Editor {
.map(|provider| provider.provider.supports_jump_to_edit())
.unwrap_or(true);
+ let icons = Self::get_prediction_provider_icons(&self.edit_prediction_provider, cx);
+
match &completion.completion {
EditPrediction::MoveWithin {
target, snapshot, ..
@@ -10103,9 +10104,9 @@ impl Editor {
.flex_1()
.child(
if target.text_anchor.to_point(snapshot).row > cursor_point.row {
- Icon::new(IconName::ZedPredictDown)
+ Icon::new(icons.down)
} else {
- Icon::new(IconName::ZedPredictUp)
+ Icon::new(icons.up)
},
)
.child(Label::new("Jump to Edit")),
@@ -10121,7 +10122,7 @@ impl Editor {
.px_2()
.gap_2()
.flex_1()
- .child(Icon::new(IconName::ZedPredict))
+ .child(Icon::new(icons.base))
.child(Label::new(format!("Jump to {file_name}"))),
)
}
@@ -10154,9 +10155,7 @@ impl Editor {
render_relative_row_jump("", cursor_point.row, first_edit_row)
.into_any_element()
} else {
- let icon_name =
- Editor::get_prediction_provider_icon_name(&self.edit_prediction_provider);
- Icon::new(icon_name).into_any_element()
+ Icon::new(icons.base).into_any_element()
};
Some(
diff --git a/crates/icons/src/icons.rs b/crates/icons/src/icons.rs
index 386414e7d7ddc223394a91381babf2f446a48be3..d55442448b0d62a5dc98895e87fcd04242bb9f9f 100644
--- a/crates/icons/src/icons.rs
+++ b/crates/icons/src/icons.rs
@@ -222,6 +222,10 @@ pub enum IconName {
SupermavenInit,
SwatchBook,
SweepAi,
+ SweepAiDisabled,
+ SweepAiDown,
+ SweepAiError,
+ SweepAiUp,
Tab,
Terminal,
TerminalAlt,
diff --git a/crates/supermaven/src/supermaven_edit_prediction_delegate.rs b/crates/supermaven/src/supermaven_edit_prediction_delegate.rs
index 9563a0aa99f1760b5af214be28f25dbf1734c371..248177d577284f43ee9959887651b496c8492770 100644
--- a/crates/supermaven/src/supermaven_edit_prediction_delegate.rs
+++ b/crates/supermaven/src/supermaven_edit_prediction_delegate.rs
@@ -1,6 +1,6 @@
use crate::{Supermaven, SupermavenCompletionStateId};
use anyhow::Result;
-use edit_prediction_types::{EditPrediction, EditPredictionDelegate};
+use edit_prediction_types::{EditPrediction, EditPredictionDelegate, EditPredictionIconSet};
use futures::StreamExt as _;
use gpui::{App, Context, Entity, EntityId, Task};
use language::{Anchor, Buffer, BufferSnapshot};
@@ -11,6 +11,7 @@ use std::{
time::Duration,
};
use text::{ToOffset, ToPoint};
+use ui::prelude::*;
use unicode_segmentation::UnicodeSegmentation;
pub const DEBOUNCE_TIMEOUT: Duration = Duration::from_millis(75);
@@ -125,6 +126,12 @@ impl EditPredictionDelegate for SupermavenEditPredictionDelegate {
false
}
+ fn icons(&self, _cx: &App) -> EditPredictionIconSet {
+ EditPredictionIconSet::new(IconName::Supermaven)
+ .with_disabled(IconName::SupermavenDisabled)
+ .with_error(IconName::SupermavenError)
+ }
+
fn is_enabled(&self, _buffer: &Entity, _cursor_position: Anchor, cx: &App) -> bool {
self.supermaven.read(cx).is_enabled()
}