@@ -391,6 +391,29 @@ impl SqlEditorWidget {
391391 self . schedule_deferred_signature_unfocus_hide ( INTELLISENSE_DEFERRED_HIDE_RETRIES ) ;
392392 }
393393
394+ fn should_defer_signature_unfocus_hide (
395+ completion_transition : IntellisensePopupTransitionState ,
396+ signature_transition : IntellisensePopupTransitionState ,
397+ ) -> bool {
398+ matches ! ( completion_transition, IntellisensePopupTransitionState :: Showing )
399+ || matches ! ( signature_transition, IntellisensePopupTransitionState :: Showing )
400+ }
401+
402+ /// Match the completion popup's unfocus behavior: close immediately once
403+ /// both popup show transitions have settled. A show transition can briefly
404+ /// unfocus the editor on macOS, so that case still uses the deferred check.
405+ pub ( crate ) fn hide_signature_popup_on_editor_unfocus ( & self ) {
406+ if Self :: should_defer_signature_unfocus_hide (
407+ self . intellisense_runtime . popup_transition_state ( ) ,
408+ self . intellisense_runtime
409+ . signature_popup_transition_state ( ) ,
410+ ) {
411+ self . schedule_deferred_signature_unfocus_hide ( INTELLISENSE_DEFERRED_HIDE_RETRIES ) ;
412+ } else {
413+ self . dismiss_signature_popup ( ) ;
414+ }
415+ }
416+
394417 /// Hide the signature popup on editor unfocus only when focus actually
395418 /// left the editor. Showing the completion popup window briefly pulls
396419 /// focus (macOS key-window flicker), which must not kill the hint; the
0 commit comments