From fc66e4e2559741449c1551b69ac4126ba3ba29d0 Mon Sep 17 00:00:00 2001 From: Ben Kunkle Date: Tue, 24 Mar 2026 18:35:48 -0500 Subject: [PATCH] ep: Only report shown once prediction is previewed in subtle mode (#52362) ## Context We currently mark the current prediction as "shown" when the subtle mode indicator appears. This doesn't really make sense. We make an effort elsewhere to differentiate between a user rejecting a prediction that they viewed vs. never saw in order to compute accurate metrics. ## Self-Review Checklist - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content is consistent with the [UI/UX checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) - [x] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable Release Notes: - N/A or Added/Fixed/Improved ... --- crates/editor/src/editor.rs | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index a6ad7219b59195bad61e73b44090d549b3ad7bf5..78ccd2c42cac7c805bcd03693fd6fc822bdaac16 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -8842,6 +8842,7 @@ impl Editor { let target = first_edit_start; EditPrediction::MoveWithin { target, snapshot } } else { + let show_completions_in_menu = self.has_visible_completions_menu(); let show_completions_in_buffer = !self.edit_prediction_visible_in_cursor_popover(true) && !self.edit_predictions_hidden_for_vim_mode; @@ -8855,16 +8856,26 @@ impl Editor { EditDisplayMode::DiffPopover }; - if show_completions_in_buffer { - if let Some(provider) = &self.edit_prediction_provider { - let suggestion_display_type = match display_mode { - EditDisplayMode::DiffPopover => SuggestionDisplayType::DiffPopover, - EditDisplayMode::Inline | EditDisplayMode::TabAccept => { - SuggestionDisplayType::GhostText - } - }; - provider.provider.did_show(suggestion_display_type, cx); + let report_shown = match display_mode { + EditDisplayMode::DiffPopover | EditDisplayMode::Inline => { + show_completions_in_buffer || show_completions_in_menu + } + EditDisplayMode::TabAccept => { + show_completions_in_menu || self.edit_prediction_preview_is_active() } + }; + + if report_shown && let Some(provider) = &self.edit_prediction_provider { + let suggestion_display_type = match display_mode { + EditDisplayMode::DiffPopover => SuggestionDisplayType::DiffPopover, + EditDisplayMode::Inline | EditDisplayMode::TabAccept => { + SuggestionDisplayType::GhostText + } + }; + provider.provider.did_show(suggestion_display_type, cx); + } + + if show_completions_in_buffer { if edits .iter() .all(|(range, _)| range.to_offset(&multibuffer).is_empty())