Skip to content

Commit

Permalink
fix: refactor disable method to improve cleanup and logging
Browse files Browse the repository at this point in the history
  • Loading branch information
ZanzyTHEbar committed Feb 17, 2025
1 parent 5955cbf commit 60eb7f1
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions gnome-extension/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,26 @@ export default class VSCodeWorkspacesExtension extends Extension {
this._initializeWorkspaces();
}

disable() {
if (this._refreshTimeout) {
GLib.source_remove(this._refreshTimeout);
this._refreshTimeout = null;
}
if (this._indicator) {
this._indicator.destroy();
this._indicator = undefined;
}
this.gsettings = undefined;

// clean up the cache
this._workspaces.clear();
this._recentWorkspaces.clear();
this._foundEditors = [];
this._activeEditor = undefined;

this._log(`VSCode Workspaces Extension disabled`);
}

_initializeWorkspaces() {
this._log('Initializing workspaces');
this._workspaces.clear();
Expand Down Expand Up @@ -156,26 +176,6 @@ export default class VSCodeWorkspacesExtension extends Extension {
}
}

disable() {
if (this._refreshTimeout) {
GLib.source_remove(this._refreshTimeout);
this._refreshTimeout = null;
}
if (this._indicator) {
this._indicator.destroy();
this._indicator = undefined;
}
this.gsettings = undefined;

// clean up the cache
this._workspaces.clear();
this._recentWorkspaces.clear();
this._foundEditors = [];
this._activeEditor = undefined;

this._log(`VSCode Workspaces Extension disabled`);
}

_setSettings() {
this._newWindow = this.gsettings!.get_value('new-window').deepUnpack() ?? false;
this._editorLocation = this.gsettings!.get_value('editor-location').deepUnpack() ?? 'auto';
Expand Down

0 comments on commit 60eb7f1

Please sign in to comment.