Skip to content

Commit 18b2755

Browse files
committed
fix: recognize PhpStorm app bundle names in macOS launch mapping
1 parent 44bae44 commit 18b2755

1 file changed

Lines changed: 21 additions & 2 deletions

File tree

  • src-tauri/src/shared/workspaces_core

src-tauri/src/shared/workspaces_core/io.rs

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ fn app_launch_strategy(app: &str) -> Option<LineAwareLaunchStrategy> {
6868
if normalized.contains("visual studio code") || normalized.starts_with("cursor") {
6969
return Some(LineAwareLaunchStrategy::GotoFlag);
7070
}
71-
if normalized == "phpstorm" {
71+
if is_phpstorm_app_identifier(&normalized) {
7272
return Some(LineAwareLaunchStrategy::JetBrainsLineColumnFlags);
7373
}
7474
if normalized == "zed" || normalized.starts_with("zed ") {
@@ -88,7 +88,7 @@ fn app_cli_command(app: &str) -> Option<&'static str> {
8888
if normalized.starts_with("cursor") {
8989
return Some("cursor");
9090
}
91-
if normalized == "phpstorm" {
91+
if is_phpstorm_app_identifier(&normalized) {
9292
return Some("phpstorm");
9393
}
9494
if normalized == "zed" || normalized.starts_with("zed ") {
@@ -97,6 +97,12 @@ fn app_cli_command(app: &str) -> Option<&'static str> {
9797
None
9898
}
9999

100+
fn is_phpstorm_app_identifier(normalized: &str) -> bool {
101+
normalized == "phpstorm"
102+
|| normalized == "phpstorm app"
103+
|| normalized.ends_with(" phpstorm app")
104+
}
105+
100106
fn find_executable_in_path(program: &str) -> Option<PathBuf> {
101107
let trimmed = program.trim();
102108
if trimmed.is_empty() {
@@ -379,6 +385,14 @@ mod tests {
379385
app_launch_strategy("Zed Preview"),
380386
Some(LineAwareLaunchStrategy::PathWithLineColumn)
381387
);
388+
assert_eq!(
389+
app_launch_strategy("PhpStorm.app"),
390+
Some(LineAwareLaunchStrategy::JetBrainsLineColumnFlags)
391+
);
392+
assert_eq!(
393+
app_launch_strategy("/Applications/PhpStorm.app"),
394+
Some(LineAwareLaunchStrategy::JetBrainsLineColumnFlags)
395+
);
382396
assert_eq!(app_launch_strategy("Ghostty"), None);
383397
}
384398

@@ -394,6 +408,11 @@ mod tests {
394408
Some("code-insiders")
395409
);
396410
assert_eq!(app_cli_command("Cursor"), Some("cursor"));
411+
assert_eq!(app_cli_command("PhpStorm.app"), Some("phpstorm"));
412+
assert_eq!(
413+
app_cli_command("/Applications/PhpStorm.app"),
414+
Some("phpstorm")
415+
);
397416
assert_eq!(app_cli_command("Zed Preview"), Some("zed"));
398417
assert_eq!(app_cli_command("Ghostty"), None);
399418
}

0 commit comments

Comments
 (0)