Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Fix edit prediction provider checkmark (#56250)

liamef65b5a2832f
diff --git a/crates/edit_prediction_ui/src/edit_prediction_button.rs b/crates/edit_prediction_ui/src/edit_prediction_button.rs
index 43edcfb8910..2246f106e72 100644
--- a/crates/edit_prediction_ui/src/edit_prediction_button.rs
+++ b/crates/edit_prediction_ui/src/edit_prediction_button.rs
@@ -594,30 +594,20 @@ impl EditPredictionButton {
continue;
};
let is_current = provider == current_provider;
+ let is_disabled_zed_provider =
+ provider == EditPredictionProvider::Zed && is_zed_provider_disabled;
let fs = self.fs.clone();
menu = menu.item(
ContextMenuEntry::new(name)
- .toggleable(
- IconPosition::Start,
- is_current
- && (provider == EditPredictionProvider::Zed
- && !is_zed_provider_disabled),
- )
- .disabled(
- provider == EditPredictionProvider::Zed && is_zed_provider_disabled,
- )
- .when(
- provider == EditPredictionProvider::Zed && is_zed_provider_disabled,
- |item| {
- item.documentation_aside(DocumentationSide::Left, move |_cx| {
- Label::new(
- "Edit predictions are disabled for this organization.",
- )
+ .toggleable(IconPosition::Start, is_current && !is_disabled_zed_provider)
+ .disabled(is_disabled_zed_provider)
+ .when(is_disabled_zed_provider, |item| {
+ item.documentation_aside(DocumentationSide::Left, move |_cx| {
+ Label::new("Edit predictions are disabled for this organization.")
.into_any_element()
- })
- },
- )
+ })
+ })
.handler(move |_, cx| {
set_completion_provider(fs.clone(), cx, provider);
}),