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

<!-- Check before requesting review: -->
- [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 ...
This commit is contained in:
Ben Kunkle authored and GitHub committed 2026-03-24 19:35:48 -04:00
1 parent 79dedc4808
commit 3f482fb20e
1 file changed
+20 -9
+20 -9
View File
@@ -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())