@@ -3,13 +3,9 @@ use std::path::PathBuf;
33use tokio:: sync:: Mutex ;
44
55use crate :: codex:: config as codex_config;
6- use crate :: types:: OpenAppTarget ;
7- use crate :: shared:: workspaces_core:: optional_open_app_targets_core;
86use crate :: storage:: write_settings;
97use crate :: types:: AppSettings ;
108
11- const OPTIONAL_OPEN_APP_TARGET_IDS : & [ & str ] = & [ "phpstorm" ] ;
12-
139fn normalize_personality ( value : & str ) -> Option < & ' static str > {
1410 match value. trim ( ) {
1511 "friendly" => Some ( "friendly" ) ,
@@ -40,7 +36,6 @@ pub(crate) async fn get_app_settings_core(app_settings: &Mutex<AppSettings>) ->
4036 . unwrap_or ( "friendly" )
4137 . to_string ( ) ;
4238 }
43- inject_optional_open_app_targets ( & mut settings) ;
4439 settings
4540}
4641
@@ -57,9 +52,7 @@ pub(crate) async fn update_app_settings_core(
5752 write_settings ( settings_path, & settings) ?;
5853 let mut current = app_settings. lock ( ) . await ;
5954 * current = settings. clone ( ) ;
60- let mut response = settings;
61- inject_optional_open_app_targets ( & mut response) ;
62- Ok ( response)
55+ Ok ( settings)
6356}
6457
6558pub ( crate ) fn get_codex_config_path_core ( ) -> Result < String , String > {
@@ -71,50 +64,3 @@ pub(crate) fn get_codex_config_path_core() -> Result<String, String> {
7164 . ok_or_else ( || "Unable to resolve CODEX_HOME" . to_string ( ) )
7265 } )
7366}
74-
75- fn inject_optional_open_app_targets ( settings : & mut AppSettings ) {
76- let optional_targets = optional_open_app_targets_core ( ) ;
77- let mut available_optional_targets_by_id = optional_targets
78- . into_iter ( )
79- . map ( |target| ( target. id . clone ( ) , target) )
80- . collect :: < std:: collections:: HashMap < String , OpenAppTarget > > ( ) ;
81- let mut existing_targets = std:: mem:: take ( & mut settings. open_app_targets ) ;
82- existing_targets. retain ( |target| {
83- !OPTIONAL_OPEN_APP_TARGET_IDS . contains ( & target. id . as_str ( ) )
84- || available_optional_targets_by_id. contains_key ( & target. id )
85- } ) ;
86-
87- let mut merged_targets =
88- Vec :: with_capacity ( existing_targets. len ( ) + available_optional_targets_by_id. len ( ) ) ;
89- let mut inserted_optional = false ;
90-
91- for target in existing_targets {
92- if OPTIONAL_OPEN_APP_TARGET_IDS . contains ( & target. id . as_str ( ) ) {
93- available_optional_targets_by_id. remove ( & target. id ) ;
94- }
95- if !inserted_optional && target. kind == "finder" {
96- merged_targets. extend ( available_optional_targets_by_id. into_values ( ) ) ;
97- available_optional_targets_by_id = std:: collections:: HashMap :: new ( ) ;
98- inserted_optional = true ;
99- }
100- merged_targets. push ( target) ;
101- }
102-
103- if !inserted_optional {
104- merged_targets. extend ( available_optional_targets_by_id. into_values ( ) ) ;
105- }
106-
107- settings. open_app_targets = merged_targets;
108-
109- if !settings
110- . open_app_targets
111- . iter ( )
112- . any ( |target| target. id == settings. selected_open_app_id )
113- {
114- settings. selected_open_app_id = settings
115- . open_app_targets
116- . first ( )
117- . map ( |target| target. id . clone ( ) )
118- . unwrap_or_default ( ) ;
119- }
120- }
0 commit comments