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.

ep: Only report shown once prediction is previewed in subtle mode (#52362)

Ben Kunklefc66e4e25597
diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs
index a6ad7219b59..78ccd2c42ca 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())