edit prediction: Show display mode options just for Zed (#27844)

Eager and Subtle modes are only supported for Zed as an edit prediction
provider and they were visible if your provider is Copilot, which is
misleading.

Release Notes:

- N/A
This commit is contained in:
Danilo Leal 2025-04-01 11:07:24 -03:00 committed by GitHub
parent 7d67bd480b
commit ab31eb5d51
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -457,38 +457,42 @@ impl InlineCompletionButton {
move |_, cx| toggle_inline_completions_globally(fs.clone(), cx) move |_, cx| toggle_inline_completions_globally(fs.clone(), cx)
}); });
menu = menu.separator().header("Display Modes"); let provider = settings.edit_predictions.provider;
let current_mode = settings.edit_predictions_mode(); let current_mode = settings.edit_predictions_mode();
let subtle_mode = matches!(current_mode, EditPredictionsMode::Subtle); let subtle_mode = matches!(current_mode, EditPredictionsMode::Subtle);
let eager_mode = matches!(current_mode, EditPredictionsMode::Eager); let eager_mode = matches!(current_mode, EditPredictionsMode::Eager);
menu = menu.item( if matches!(provider, EditPredictionProvider::Zed) {
ContextMenuEntry::new("Eager") menu = menu
.toggleable(IconPosition::Start, eager_mode) .separator()
.documentation_aside(move |_| { .header("Display Modes")
Label::new("Display predictions inline when there are no language server completions available.").into_any_element() .item(
}) ContextMenuEntry::new("Eager")
.handler({ .toggleable(IconPosition::Start, eager_mode)
let fs = fs.clone(); .documentation_aside(move |_| {
move |_, cx| { Label::new("Display predictions inline when there are no language server completions available.").into_any_element()
toggle_edit_prediction_mode(fs.clone(), EditPredictionsMode::Eager, cx) })
} .handler({
}), let fs = fs.clone();
); move |_, cx| {
toggle_edit_prediction_mode(fs.clone(), EditPredictionsMode::Eager, cx)
menu = menu.item( }
ContextMenuEntry::new("Subtle") }),
.toggleable(IconPosition::Start, subtle_mode) )
.documentation_aside(move |_| { .item(
Label::new("Display predictions inline only when holding a modifier key (alt by default).").into_any_element() ContextMenuEntry::new("Subtle")
}) .toggleable(IconPosition::Start, subtle_mode)
.handler({ .documentation_aside(move |_| {
let fs = fs.clone(); Label::new("Display predictions inline only when holding a modifier key (alt by default).").into_any_element()
move |_, cx| { })
toggle_edit_prediction_mode(fs.clone(), EditPredictionsMode::Subtle, cx) .handler({
} let fs = fs.clone();
}), move |_, cx| {
); toggle_edit_prediction_mode(fs.clone(), EditPredictionsMode::Subtle, cx)
}
}),
);
}
menu = menu.separator().header("Privacy Settings"); menu = menu.separator().header("Privacy Settings");
if let Some(provider) = &self.edit_prediction_provider { if let Some(provider) = &self.edit_prediction_provider {