Skip to content

Commit 5746581

Browse files
authored
chore: update version to 0.6.5 and adjust settings scope for saving preferences (#76)
1 parent 452275d commit 5746581

2 files changed

Lines changed: 27 additions & 15 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "simple-coding-time-tracker",
33
"displayName": "Simple Coding Time Tracker",
44
"description": "Track and visualize your coding time across projects",
5-
"version": "0.6.4",
5+
"version": "0.6.5",
66
"publisher": "noorashuvo",
77
"license": "MIT",
88
"icon": "icon-sctt.png",

src/settingsView.ts

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)