-
-
Notifications
You must be signed in to change notification settings - Fork 308
Feat: Add PHPStorm to the IDE selection and add CSS to stretch out command output block to full width for larger screens #566
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
afcb970
3861093
f6c9b1b
41d8bb3
387f0b9
c1b4a01
1d84967
3f18662
0732034
026ffc9
97969f4
5035fde
d372eed
742857c
363d2fa
44bae44
18b2755
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,11 +31,13 @@ pub(crate) fn read_settings(path: &PathBuf) -> Result<AppSettings, String> { | |
| let data = std::fs::read_to_string(path).map_err(|e| e.to_string())?; | ||
| let mut value: Value = serde_json::from_str(&data).map_err(|e| e.to_string())?; | ||
| migrate_follow_up_message_behavior(&mut value); | ||
| migrate_open_app_targets(&mut value); | ||
| match serde_json::from_value(value.clone()) { | ||
| Ok(settings) => Ok(settings), | ||
| Err(_) => { | ||
| sanitize_remote_settings_for_tcp_only(&mut value); | ||
| migrate_follow_up_message_behavior(&mut value); | ||
| migrate_open_app_targets(&mut value); | ||
| serde_json::from_value(value).map_err(|e| e.to_string()) | ||
| } | ||
| } | ||
|
|
@@ -92,6 +94,39 @@ fn migrate_follow_up_message_behavior(value: &mut Value) { | |
| ); | ||
| } | ||
|
|
||
| fn migrate_open_app_targets(value: &mut Value) { | ||
| let Value::Object(root) = value else { | ||
| return; | ||
| }; | ||
| let Some(Value::Array(existing_targets)) = root.get_mut("openAppTargets") else { | ||
| return; | ||
| }; | ||
|
|
||
| let has_phpstorm = existing_targets | ||
| .iter() | ||
| .any(|target| target.get("id").and_then(Value::as_str) == Some("phpstorm")); | ||
| if has_phpstorm { | ||
| return; | ||
| } | ||
|
|
||
| let phpstorm_target = match serde_json::to_value(AppSettings::default().open_app_targets) { | ||
| Ok(Value::Array(targets)) => targets | ||
| .into_iter() | ||
| .find(|target| target.get("id").and_then(Value::as_str) == Some("phpstorm")), | ||
| _ => None, | ||
| }; | ||
| let Some(phpstorm_target) = phpstorm_target else { | ||
| return; | ||
| }; | ||
|
|
||
| let insert_at = existing_targets | ||
| .iter() | ||
| .position(|target| target.get("id").and_then(Value::as_str) == Some("finder")) | ||
| .unwrap_or(existing_targets.len()); | ||
|
|
||
| existing_targets.insert(insert_at, phpstorm_target); | ||
|
Comment on lines
+123
to
+127
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Useful? React with 👍 / 👎. |
||
| } | ||
|
|
||
| #[cfg(test)] | ||
| mod tests { | ||
| use super::{read_settings, read_workspaces, write_workspaces}; | ||
|
|
@@ -251,4 +286,48 @@ mod tests { | |
| let settings = read_settings(&path).expect("read settings"); | ||
| assert_eq!(settings.follow_up_message_behavior, "queue"); | ||
| } | ||
|
|
||
| #[test] | ||
| fn read_settings_migrates_missing_open_app_targets() { | ||
| let temp_dir = std::env::temp_dir().join(format!("codex-monitor-test-{}", Uuid::new_v4())); | ||
| std::fs::create_dir_all(&temp_dir).expect("create temp dir"); | ||
| let path = temp_dir.join("settings.json"); | ||
|
|
||
| std::fs::write( | ||
| &path, | ||
| r#"{ | ||
| "theme": "dark", | ||
| "selectedOpenAppId": "vscode", | ||
| "openAppTargets": [ | ||
| { "id": "vscode", "label": "VS Code", "kind": "command", "appName": null, "command": "code", "args": [] }, | ||
| { "id": "cursor", "label": "Cursor", "kind": "command", "appName": null, "command": "cursor", "args": [] }, | ||
| { "id": "zed", "label": "Zed", "kind": "command", "appName": null, "command": "zed", "args": [] }, | ||
| { "id": "ghostty", "label": "Ghostty", "kind": "command", "appName": null, "command": "ghostty", "args": [] }, | ||
| { "id": "antigravity", "label": "Antigravity", "kind": "command", "appName": null, "command": "antigravity", "args": [] }, | ||
| { "id": "finder", "label": "File Manager", "kind": "finder", "appName": null, "command": null, "args": [] } | ||
| ] | ||
| }"#, | ||
| ) | ||
| .expect("write settings"); | ||
|
|
||
| let settings = read_settings(&path).expect("read settings"); | ||
| let ids: Vec<&str> = settings | ||
| .open_app_targets | ||
| .iter() | ||
| .map(|target| target.id.as_str()) | ||
| .collect(); | ||
|
|
||
| assert_eq!( | ||
| ids, | ||
| vec![ | ||
| "vscode", | ||
| "cursor", | ||
| "zed", | ||
| "ghostty", | ||
| "antigravity", | ||
| "phpstorm", | ||
| "finder" | ||
| ] | ||
| ); | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For macOS file links with a line/column, every recognized PhpStorm app name/path is collapsed to the global
phpstormlauncher here, andopen_workspace_in_core()then prefers that CLI (io.rs:265-273) overopen -a <configured app>. Because the app name field is user-editable in Settings (src/features/settings/components/sections/SettingsOpenAppsSection.tsx:111-126), users who point it at a specificPhpStorm.appbundle (for example a non-default install or a second build) will still open whichever installation the PATH launcher targets, not the one they selected.Useful? React with 👍 / 👎.