Skip to content

Commit d60473d

Browse files
committed
시그니처 기능 개선
1 parent d608d12 commit d60473d

4 files changed

Lines changed: 44 additions & 2 deletions

File tree

src/ui/sql_editor/intellisense/popup.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

src/ui/sql_editor/intellisense/runtime.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1746,8 +1746,7 @@ impl SqlEditorWidget {
17461746
});
17471747
Self::apply_hangul_first_key_repair_edit(&mut buffer_for_handle, edit);
17481748
}
1749-
widget_for_shortcuts
1750-
.schedule_deferred_signature_unfocus_hide(INTELLISENSE_DEFERRED_HIDE_RETRIES);
1749+
widget_for_shortcuts.hide_signature_popup_on_editor_unfocus();
17511750
let unfocus_x = fltk::app::event_x_root();
17521751
let unfocus_y = fltk::app::event_y_root();
17531752
if matches!(

src/ui/sql_editor/intellisense/tests.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9659,6 +9659,22 @@ fn popup_unfocus_hide_waits_for_focus_and_show_transition_to_settle() {
96599659
));
96609660
}
96619661

9662+
#[test]
9663+
fn signature_popup_unfocus_hide_is_deferred_only_while_a_popup_is_being_shown() {
9664+
assert!(!SqlEditorWidget::should_defer_signature_unfocus_hide(
9665+
IntellisensePopupTransitionState::Idle,
9666+
IntellisensePopupTransitionState::Idle,
9667+
));
9668+
assert!(SqlEditorWidget::should_defer_signature_unfocus_hide(
9669+
IntellisensePopupTransitionState::Showing,
9670+
IntellisensePopupTransitionState::Idle,
9671+
));
9672+
assert!(SqlEditorWidget::should_defer_signature_unfocus_hide(
9673+
IntellisensePopupTransitionState::Idle,
9674+
IntellisensePopupTransitionState::Showing,
9675+
));
9676+
}
9677+
96629678
#[test]
96639679
fn popup_hides_never_block_on_a_busy_mutex() {
96649680
assert!(SqlEditorWidget::can_try_hide_intellisense_popup(

src/ui/sql_editor/intellisense_state.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -610,6 +610,10 @@ impl IntellisenseRuntimeState {
610610
store_popup_transition_state(&self.signature_popup_show_in_progress, state);
611611
}
612612

613+
pub(crate) fn signature_popup_transition_state(&self) -> IntellisensePopupTransitionState {
614+
load_popup_transition_state(&self.signature_popup_show_in_progress)
615+
}
616+
613617
pub(crate) fn next_signature_popup_request_generation(&self) -> u64 {
614618
self.signature_popup_request_generation
615619
.fetch_add(1, Ordering::AcqRel)

0 commit comments

Comments
 (0)