@@ -75,21 +75,30 @@ export class SettingsViewProvider {
7575 const config = vscode . workspace . getConfiguration ( 'simpleCodingTimeTracker' ) ;
7676
7777 try {
78- await config . update ( 'inactivityTimeout' , settings . inactivityTimeout , vscode . ConfigurationTarget . Global ) ;
79- await config . update ( 'focusTimeout' , settings . focusTimeout , vscode . ConfigurationTarget . Global ) ;
80- await config . update ( 'health.enableNotifications' , settings . healthEnableNotifications , vscode . ConfigurationTarget . Global ) ;
81- await config . update ( 'health.modalNotifications' , settings . healthModalNotifications , vscode . ConfigurationTarget . Global ) ;
82- await config . update ( 'health.eyeRestInterval' , settings . healthEyeRestInterval , vscode . ConfigurationTarget . Global ) ;
83- await config . update ( 'health.stretchInterval' , settings . healthStretchInterval , vscode . ConfigurationTarget . Global ) ;
84- await config . update ( 'health.breakThreshold' , settings . healthBreakThreshold , vscode . ConfigurationTarget . Global ) ;
78+ // Most settings should be saved to Workspace scope (default behavior in package.json)
79+ await config . update ( 'inactivityTimeout' , settings . inactivityTimeout , vscode . ConfigurationTarget . Workspace ) ;
80+ await config . update ( 'focusTimeout' , settings . focusTimeout , vscode . ConfigurationTarget . Workspace ) ;
81+ await config . update ( 'health.enableNotifications' , settings . healthEnableNotifications , vscode . ConfigurationTarget . Workspace ) ;
82+ await config . update ( 'health.modalNotifications' , settings . healthModalNotifications , vscode . ConfigurationTarget . Workspace ) ;
83+ await config . update ( 'health.eyeRestInterval' , settings . healthEyeRestInterval , vscode . ConfigurationTarget . Workspace ) ;
84+ await config . update ( 'health.stretchInterval' , settings . healthStretchInterval , vscode . ConfigurationTarget . Workspace ) ;
85+ await config . update ( 'health.breakThreshold' , settings . healthBreakThreshold , vscode . ConfigurationTarget . Workspace ) ;
86+
87+ // Only enableDevCommands has "scope": "application" in package.json, so it must be saved to Global
8588 await config . update ( 'enableDevCommands' , settings . enableDevCommands , vscode . ConfigurationTarget . Global ) ;
8689
90+ console . log ( 'Settings saved successfully:' , settings ) ;
8791 vscode . window . showInformationMessage ( '✅ Settings saved successfully!' ) ;
8892
8993 if ( this . panel ) {
9094 this . panel . webview . postMessage ( { command : 'saveSuccess' } ) ;
9195 }
96+
97+ // Trigger a configuration change event manually if needed
98+ // The onDidChangeConfiguration should fire automatically, but we log for debugging
99+ console . log ( 'Configuration should update automatically via onDidChangeConfiguration event' ) ;
92100 } catch ( error ) {
101+ console . error ( 'Failed to save settings:' , error ) ;
93102 vscode . window . showErrorMessage ( `Failed to save settings: ${ error } ` ) ;
94103 }
95104 }
@@ -98,13 +107,16 @@ export class SettingsViewProvider {
98107 const config = vscode . workspace . getConfiguration ( 'simpleCodingTimeTracker' ) ;
99108
100109 try {
101- await config . update ( 'inactivityTimeout' , undefined , vscode . ConfigurationTarget . Global ) ;
102- await config . update ( 'focusTimeout' , undefined , vscode . ConfigurationTarget . Global ) ;
103- await config . update ( 'health.enableNotifications' , undefined , vscode . ConfigurationTarget . Global ) ;
104- await config . update ( 'health.modalNotifications' , undefined , vscode . ConfigurationTarget . Global ) ;
105- await config . update ( 'health.eyeRestInterval' , undefined , vscode . ConfigurationTarget . Global ) ;
106- await config . update ( 'health.stretchInterval' , undefined , vscode . ConfigurationTarget . Global ) ;
107- await config . update ( 'health.breakThreshold' , undefined , vscode . ConfigurationTarget . Global ) ;
110+ // Reset workspace-scoped settings
111+ await config . update ( 'inactivityTimeout' , undefined , vscode . ConfigurationTarget . Workspace ) ;
112+ await config . update ( 'focusTimeout' , undefined , vscode . ConfigurationTarget . Workspace ) ;
113+ await config . update ( 'health.enableNotifications' , undefined , vscode . ConfigurationTarget . Workspace ) ;
114+ await config . update ( 'health.modalNotifications' , undefined , vscode . ConfigurationTarget . Workspace ) ;
115+ await config . update ( 'health.eyeRestInterval' , undefined , vscode . ConfigurationTarget . Workspace ) ;
116+ await config . update ( 'health.stretchInterval' , undefined , vscode . ConfigurationTarget . Workspace ) ;
117+ await config . update ( 'health.breakThreshold' , undefined , vscode . ConfigurationTarget . Workspace ) ;
118+
119+ // Reset global-scoped settings
108120 await config . update ( 'enableDevCommands' , undefined , vscode . ConfigurationTarget . Global ) ;
109121
110122 vscode . window . showInformationMessage ( '✅ Settings reset to defaults!' ) ;
0 commit comments