From 5ef6402d645b40993e58704a2ba735015cc7f668 Mon Sep 17 00:00:00 2001 From: Dino Date: Thu, 20 Nov 2025 16:25:09 +0000 Subject: [PATCH] editor: Ensure all menus and popups are dismissed (#43169) While investigating a bug report that, in Helix mode, pressing the `escape` key would only hide the signature help popup and not the completions menu, when `auto_signature_help` was enabled, it was noted that the `editor::Editor.dismiss_menus_and_popups` method was not dismissing all possible menus and popups and was, instead, stopping as soon as a single menu or popup was dismissed. From the name of the method it appears that we actually want to dismiss all so this commit updates it as such, ensuring that the bug reported is also fixed. Closes #42499 Release Notes: - Fixed issue with popups and menus not being dismissed while using `auto_signature_help` in Helix Mode --- crates/editor/src/editor.rs | 43 ++++++++++--------------------------- 1 file changed, 11 insertions(+), 32 deletions(-) diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index 9401d5a1e2f36f7b0c00c4c3dec3fc90597290e5..5d1c24bcad76333beee8941ee729b9578bb7ad65 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -4122,44 +4122,23 @@ impl Editor { window: &mut Window, cx: &mut Context, ) -> bool { - if self.take_rename(false, window, cx).is_some() { - return true; - } - - if self.hide_blame_popover(true, cx) { - return true; - } - - if hide_hover(self, cx) { - return true; - } - - if self.hide_signature_help(cx, SignatureHelpHiddenBy::Escape) { - return true; - } - - if self.hide_context_menu(window, cx).is_some() { - return true; - } - - if self.mouse_context_menu.take().is_some() { - return true; - } - - if is_user_requested && self.discard_edit_prediction(true, cx) { - return true; - } + let mut dismissed = false; - if self.snippet_stack.pop().is_some() { - return true; - } + dismissed |= self.take_rename(false, window, cx).is_some(); + dismissed |= self.hide_blame_popover(true, cx); + dismissed |= hide_hover(self, cx); + dismissed |= self.hide_signature_help(cx, SignatureHelpHiddenBy::Escape); + dismissed |= self.hide_context_menu(window, cx).is_some(); + dismissed |= self.mouse_context_menu.take().is_some(); + dismissed |= is_user_requested && self.discard_edit_prediction(true, cx); + dismissed |= self.snippet_stack.pop().is_some(); if self.mode.is_full() && matches!(self.active_diagnostics, ActiveDiagnostic::Group(_)) { self.dismiss_diagnostics(cx); - return true; + dismissed = true; } - false + dismissed } fn linked_editing_ranges_for(