Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions crates/jcode-setup-hints/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,15 +203,6 @@ pub struct StartupHints {
}

impl StartupHints {
#[allow(dead_code)] // Only populated on macOS/test cfgs; see startup_hints_for_launch.
fn with_spawn_notice(message: String) -> Self {
Self {
auto_send_message: None,
status_notice: Some(message.clone()),
display_message: Some(("Launch".to_string(), message)),
}
}

fn with_status_and_display(
status_notice: String,
title: impl Into<String>,
Expand Down
28 changes: 17 additions & 11 deletions crates/jcode-setup-hints/src/setup_hints_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,32 @@ fn launches_after_third_do_not_show_generic_alignment_tip() {
assert!(startup_hints_for_launch(&state).is_none());
}

// Asserts the macOS-specific spawn notice text (`Cmd+;` etc.), so it only makes
// sense on macOS. On other platforms the notice uses different chords/wording.
// The macOS launch-hotkey spawn notice was retired by PR #128 (commit
// 081c1cf6, "refactor(setup-hints): remove unreachable startup spawn notice"):
// nothing in the crate ever wrote `startup_spawn_hint_dismissed = false`, so
// the prior `if !hotkey_configured || dismissed` gate always evaluated to None
// in practice. The function now returns `None` unconditionally. This test
// stays as a regression guard against the gate being re-introduced with the
// wrong default, and to keep the macOS-only cfg symmetric with the other
// launch-hotkey notice tests in this file.
#[cfg(target_os = "macos")]
#[test]
fn first_three_launches_can_include_hotkey_notice_too() {
let state = SetupHintsState {
launch_count: 2,
hotkey_configured: true,
// Even when the user has dismissed the (now-retired) notice, the
// function must still return None — the spawn notice was retired,
// not gated. Re-introducing a hotkey-notice gate here would require
// also fixing this assertion.
startup_spawn_hint_dismissed: true,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARNING: The regression guard is weakened by setting startup_spawn_hint_dismissed: true. The retired gate was if !hotkey_configured || dismissed { None }, so with dismissed = true the assertion still passes even if that gate is reintroduced with the wrong default. Set it to false so the test actually catches a re-introduced gate that fails to suppress the notice.

Suggested change
startup_spawn_hint_dismissed: true,
startup_spawn_hint_dismissed: false,

..SetupHintsState::default()
};

let hints = startup_hints_for_launch(&state).expect("expected startup hint");
let (_, message) = hints.display_message.expect("expected display message");
assert!(!message.contains("Alt+C"));
assert!(message.contains("Cmd+;"));
// The notice should make clear the hotkey works globally, not just inside jcode.
assert!(message.contains("system-wide"));
// All three launch hotkeys should be mentioned.
assert!(message.contains("Cmd+'"));
assert!(message.contains("Cmd+Shift+'"));
assert!(
startup_hints_for_launch(&state).is_none(),
"spawn notice was retired in PR #128; startup_hints_for_launch must always return None",
);
}

#[test]
Expand Down
Loading