diff --git a/src/vs/editor/contrib/multicursor/test/multicursor.test.ts b/src/vs/editor/contrib/multicursor/test/multicursor.test.ts index b9b1c5778eb..56ec69d45eb 100644 --- a/src/vs/editor/contrib/multicursor/test/multicursor.test.ts +++ b/src/vs/editor/contrib/multicursor/test/multicursor.test.ts @@ -61,7 +61,7 @@ suite('Multicursor selection', () => { let serviceCollection = new ServiceCollection(); serviceCollection.set(IStorageService, { _serviceBrand: undefined, - onDidChangeStorage: Event.None, + onDidChangeValue: Event.None, onDidChangeTarget: Event.None, onWillSaveState: Event.None, get: (key: string) => queryState[key], diff --git a/src/vs/platform/extensionManagement/common/extensionEnablementService.ts b/src/vs/platform/extensionManagement/common/extensionEnablementService.ts index 096d43f6048..990e670c8df 100644 --- a/src/vs/platform/extensionManagement/common/extensionEnablementService.ts +++ b/src/vs/platform/extensionManagement/common/extensionEnablementService.ts @@ -7,7 +7,7 @@ import { Event, Emitter } from 'vs/base/common/event'; import { Disposable } from 'vs/base/common/lifecycle'; import { IExtensionIdentifier, IGlobalExtensionEnablementService, DISABLED_EXTENSIONS_STORAGE_PATH } from 'vs/platform/extensionManagement/common/extensionManagement'; import { areSameExtensions } from 'vs/platform/extensionManagement/common/extensionManagementUtil'; -import { IStorageService, StorageScope, IStorageChangeEvent } from 'vs/platform/storage/common/storage'; +import { IStorageService, StorageScope, IStorageValueChangeEvent } from 'vs/platform/storage/common/storage'; import { isUndefinedOrNull } from 'vs/base/common/types'; export class GlobalExtensionEnablementService extends Disposable implements IGlobalExtensionEnablementService { @@ -96,7 +96,7 @@ export class StorageManager extends Disposable { constructor(private storageService: IStorageService) { super(); - this._register(storageService.onDidChangeStorage(e => this.onDidStorageChange(e))); + this._register(storageService.onDidChangeValue(e => this.onDidStorageChange(e))); } get(key: string, scope: StorageScope): IExtensionIdentifier[] { @@ -127,7 +127,7 @@ export class StorageManager extends Disposable { } } - private onDidStorageChange(storageChangeEvent: IStorageChangeEvent): void { + private onDidStorageChange(storageChangeEvent: IStorageValueChangeEvent): void { if (storageChangeEvent.scope === StorageScope.GLOBAL) { if (!isUndefinedOrNull(this.storage[storageChangeEvent.key])) { const newValue = this._get(storageChangeEvent.key, storageChangeEvent.scope); diff --git a/src/vs/platform/storage/browser/storageService.ts b/src/vs/platform/storage/browser/storageService.ts index 2d92fcf018a..c667dd88f88 100644 --- a/src/vs/platform/storage/browser/storageService.ts +++ b/src/vs/platform/storage/browser/storageService.ts @@ -62,13 +62,13 @@ export class BrowserStorageService extends AbstractStorageService { this.workspaceStorageDatabase = this._register(new FileStorageDatabase(this.workspaceStorageFile, false /* do not watch for external changes */, this.fileService)); this.workspaceStorage = this._register(new Storage(this.workspaceStorageDatabase)); - this._register(this.workspaceStorage.onDidChangeStorage(key => this.emitDidChangeStorage(StorageScope.WORKSPACE, key))); + this._register(this.workspaceStorage.onDidChangeStorage(key => this.emitDidChangeValue(StorageScope.WORKSPACE, key))); // Global Storage this.globalStorageFile = joinPath(stateRoot, 'global.json'); this.globalStorageDatabase = this._register(new FileStorageDatabase(this.globalStorageFile, true /* watch for external changes */, this.fileService)); this.globalStorage = this._register(new Storage(this.globalStorageDatabase)); - this._register(this.globalStorage.onDidChangeStorage(key => this.emitDidChangeStorage(StorageScope.GLOBAL, key))); + this._register(this.globalStorage.onDidChangeStorage(key => this.emitDidChangeValue(StorageScope.GLOBAL, key))); // Init both await Promise.all([ diff --git a/src/vs/platform/storage/common/storage.ts b/src/vs/platform/storage/common/storage.ts index fd6d7d5fd44..5b515af5759 100644 --- a/src/vs/platform/storage/common/storage.ts +++ b/src/vs/platform/storage/common/storage.ts @@ -30,7 +30,7 @@ export interface IStorageService { /** * Emitted whenever data is updated or deleted. */ - readonly onDidChangeStorage: Event; + readonly onDidChangeValue: Event; /** * Emitted whenever target of a storage entry changes. @@ -180,7 +180,7 @@ export const enum StorageTarget { MACHINE } -export interface IStorageChangeEvent { +export interface IStorageValueChangeEvent { /** * The scope for the storage entry that changed @@ -213,8 +213,8 @@ export abstract class AbstractStorageService extends Disposable implements IStor declare readonly _serviceBrand: undefined; - private readonly _onDidChangeStorage = this._register(new PauseableEmitter()); - readonly onDidChangeStorage = this._onDidChangeStorage.event; + private readonly _onDidChangeValue = this._register(new PauseableEmitter()); + readonly onDidChangeValue = this._onDidChangeValue.event; private readonly _onDidChangeTarget = this._register(new PauseableEmitter()); readonly onDidChangeTarget = this._onDidChangeTarget.event; @@ -222,7 +222,7 @@ export abstract class AbstractStorageService extends Disposable implements IStor private readonly _onWillSaveState = this._register(new Emitter()); readonly onWillSaveState = this._onWillSaveState.event; - protected emitDidChangeStorage(scope: StorageScope, key: string): void { + protected emitDidChangeValue(scope: StorageScope, key: string): void { // Specially handle `TARGET_KEY` if (key === TARGET_KEY) { @@ -240,7 +240,7 @@ export abstract class AbstractStorageService extends Disposable implements IStor // Emit any other key to outside else { - this._onDidChangeStorage.fire({ scope, key, target: this.getKeyTargets(scope)[key] }); + this._onDidChangeValue.fire({ scope, key, target: this.getKeyTargets(scope)[key] }); } } @@ -287,7 +287,7 @@ export abstract class AbstractStorageService extends Disposable implements IStor private withPausedEmitters(fn: Function): void { // Pause emitters - this._onDidChangeStorage.pause(); + this._onDidChangeValue.pause(); this._onDidChangeTarget.pause(); try { @@ -295,7 +295,7 @@ export abstract class AbstractStorageService extends Disposable implements IStor } finally { // Resume emitters - this._onDidChangeStorage.resume(); + this._onDidChangeValue.resume(); this._onDidChangeTarget.resume(); } } @@ -458,7 +458,7 @@ export class InMemoryStorageService extends AbstractStorageService { this.getCache(scope).set(key, valueStr); // Events - this.emitDidChangeStorage(scope, key); + this.emitDidChangeValue(scope, key); } protected doRemove(key: string, scope: StorageScope): void { @@ -468,7 +468,7 @@ export class InMemoryStorageService extends AbstractStorageService { } // Events - this.emitDidChangeStorage(scope, key); + this.emitDidChangeValue(scope, key); } logStorage(): void { diff --git a/src/vs/platform/storage/node/storageService.ts b/src/vs/platform/storage/node/storageService.ts index d1d2aae6a3c..11049a8f969 100644 --- a/src/vs/platform/storage/node/storageService.ts +++ b/src/vs/platform/storage/node/storageService.ts @@ -45,7 +45,7 @@ export class NativeStorageService extends AbstractStorageService { private registerListeners(): void { // Global Storage change events - this._register(this.globalStorage.onDidChangeStorage(key => this.emitDidChangeStorage(StorageScope.GLOBAL, key))); + this._register(this.globalStorage.onDidChangeStorage(key => this.emitDidChangeValue(StorageScope.GLOBAL, key))); } initialize(payload?: IWorkspaceInitializationPayload): Promise { @@ -121,7 +121,7 @@ export class NativeStorageService extends AbstractStorageService { // Create new this.workspaceStoragePath = workspaceStoragePath; this.workspaceStorage = new Storage(new SQLiteStorageDatabase(workspaceStoragePath, { logging: workspaceLoggingOptions }), { hint }); - this.workspaceStorageListener = this.workspaceStorage.onDidChangeStorage(key => this.emitDidChangeStorage(StorageScope.WORKSPACE, key)); + this.workspaceStorageListener = this.workspaceStorage.onDidChangeStorage(key => this.emitDidChangeValue(StorageScope.WORKSPACE, key)); return this.workspaceStorage; } diff --git a/src/vs/platform/storage/test/common/storageService.test.ts b/src/vs/platform/storage/test/common/storageService.test.ts index eaf4a4a6606..6d22dd224a5 100644 --- a/src/vs/platform/storage/test/common/storageService.test.ts +++ b/src/vs/platform/storage/test/common/storageService.test.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { strictEqual, ok, equal } from 'assert'; -import { StorageScope, InMemoryStorageService, StorageTarget, IStorageChangeEvent, IStorageTargetChangeEvent } from 'vs/platform/storage/common/storage'; +import { StorageScope, InMemoryStorageService, StorageTarget, IStorageValueChangeEvent, IStorageTargetChangeEvent } from 'vs/platform/storage/common/storage'; suite('StorageService', function () { @@ -19,8 +19,8 @@ suite('StorageService', function () { function storeData(scope: StorageScope): void { const storage = new InMemoryStorageService(); - let storageEvents: IStorageChangeEvent[] = []; - storage.onDidChangeStorage(e => storageEvents.push(e)); + let storageValueChangeEvents: IStorageValueChangeEvent[] = []; + storage.onDidChangeValue(e => storageValueChangeEvents.push(e)); strictEqual(storage.get('test.get', scope, 'foobar'), 'foobar'); strictEqual(storage.get('test.get', scope, ''), ''); @@ -31,16 +31,16 @@ suite('StorageService', function () { storage.store('test.get', 'foobar', scope); strictEqual(storage.get('test.get', scope, (undefined)!), 'foobar'); - let storageEvent = storageEvents.find(e => e.key === 'test.get'); - equal(storageEvent?.scope, scope); - equal(storageEvent?.key, 'test.get'); - storageEvents = []; + let storageValueChangeEvent = storageValueChangeEvents.find(e => e.key === 'test.get'); + equal(storageValueChangeEvent?.scope, scope); + equal(storageValueChangeEvent?.key, 'test.get'); + storageValueChangeEvents = []; storage.store('test.get', '', scope); strictEqual(storage.get('test.get', scope, (undefined)!), ''); - storageEvent = storageEvents.find(e => e.key === 'test.get'); - equal(storageEvent!.scope, scope); - equal(storageEvent!.key, 'test.get'); + storageValueChangeEvent = storageValueChangeEvents.find(e => e.key === 'test.get'); + equal(storageValueChangeEvent!.scope, scope); + equal(storageValueChangeEvent!.key, 'test.get'); storage.store('test.getNumber', 5, scope); strictEqual(storage.getNumber('test.getNumber', scope, (undefined)!), 5); @@ -70,17 +70,17 @@ suite('StorageService', function () { function removeData(scope: StorageScope): void { const storage = new InMemoryStorageService(); - let storageEvents: IStorageChangeEvent[] = []; - storage.onDidChangeStorage(e => storageEvents.push(e)); + let storageValueChangeEvents: IStorageValueChangeEvent[] = []; + storage.onDidChangeValue(e => storageValueChangeEvents.push(e)); storage.store('test.remove', 'foobar', scope); strictEqual('foobar', storage.get('test.remove', scope, (undefined)!)); storage.remove('test.remove', scope); ok(!storage.get('test.remove', scope, (undefined)!)); - let storageEvent = storageEvents.find(e => e.key === 'test.remove'); - equal(storageEvent?.scope, scope); - equal(storageEvent?.key, 'test.remove'); + let storageValueChangeEvent = storageValueChangeEvents.find(e => e.key === 'test.remove'); + equal(storageValueChangeEvent?.scope, scope); + equal(storageValueChangeEvent?.key, 'test.remove'); } test('Keys (in-memory)', () => { @@ -89,8 +89,8 @@ suite('StorageService', function () { let storageTargetEvent: IStorageTargetChangeEvent | undefined = undefined; storage.onDidChangeTarget(e => storageTargetEvent = e); - let storageChangeEvent: IStorageChangeEvent | undefined = undefined; - storage.onDidChangeStorage(e => storageChangeEvent = e); + let storageValueChangeEvent: IStorageValueChangeEvent | undefined = undefined; + storage.onDidChangeValue(e => storageValueChangeEvent = e); // Empty for (const scope of [StorageScope.WORKSPACE, StorageScope.GLOBAL]) { @@ -103,24 +103,24 @@ suite('StorageService', function () { for (const scope of [StorageScope.WORKSPACE, StorageScope.GLOBAL]) { for (const target of [StorageTarget.MACHINE, StorageTarget.USER]) { storageTargetEvent = Object.create(null); - storageChangeEvent = Object.create(null); + storageValueChangeEvent = Object.create(null); storage.store2('test.target1', 'value1', scope, target); strictEqual(storage.keys(scope, target).length, 1); equal(storageTargetEvent?.scope, scope); - equal(storageChangeEvent?.key, 'test.target1'); - equal(storageChangeEvent?.scope, scope); - equal(storageChangeEvent?.target, target); + equal(storageValueChangeEvent?.key, 'test.target1'); + equal(storageValueChangeEvent?.scope, scope); + equal(storageValueChangeEvent?.target, target); storageTargetEvent = undefined; - storageChangeEvent = Object.create(null); + storageValueChangeEvent = Object.create(null); storage.store2('test.target1', 'otherValue1', scope, target); strictEqual(storage.keys(scope, target).length, 1); equal(storageTargetEvent, undefined); - equal(storageChangeEvent?.key, 'test.target1'); - equal(storageChangeEvent?.scope, scope); - equal(storageChangeEvent?.target, target); + equal(storageValueChangeEvent?.key, 'test.target1'); + equal(storageValueChangeEvent?.scope, scope); + equal(storageValueChangeEvent?.target, target); storage.store2('test.target2', 'value2', scope, target); storage.store2('test.target3', 'value3', scope, target); @@ -138,13 +138,13 @@ suite('StorageService', function () { strictEqual(storage.keys(scope, target).length, keysLength + 1); storageTargetEvent = Object.create(null); - storageChangeEvent = Object.create(null); + storageValueChangeEvent = Object.create(null); storage.remove('test.target4', scope); strictEqual(storage.keys(scope, target).length, keysLength); equal(storageTargetEvent?.scope, scope); - equal(storageChangeEvent?.key, 'test.target4'); - equal(storageChangeEvent?.scope, scope); + equal(storageValueChangeEvent?.key, 'test.target4'); + equal(storageValueChangeEvent?.scope, scope); } } diff --git a/src/vs/platform/userDataSync/common/extensionsSync.ts b/src/vs/platform/userDataSync/common/extensionsSync.ts index 60d21a3ee86..fd74504f55f 100644 --- a/src/vs/platform/userDataSync/common/extensionsSync.ts +++ b/src/vs/platform/userDataSync/common/extensionsSync.ts @@ -115,7 +115,7 @@ export class ExtensionsSynchroniser extends AbstractSynchroniser implements IUse Event.filter(this.extensionManagementService.onDidUninstallExtension, (e => !e.error)), this.extensionEnablementService.onDidChangeEnablement, this.storageKeysSyncRegistryService.onDidChangeExtensionStorageKeys, - Event.filter(this.storageService.onDidChangeStorage, e => e.scope === StorageScope.GLOBAL + Event.filter(this.storageService.onDidChangeValue, e => e.scope === StorageScope.GLOBAL && this.storageKeysSyncRegistryService.extensionsStorageKeys.some(([extensionIdentifier]) => areSameExtensions(extensionIdentifier, { id: e.key })))), () => undefined, 500)(() => this.triggerLocalChange())); } diff --git a/src/vs/platform/userDataSync/common/globalStateSync.ts b/src/vs/platform/userDataSync/common/globalStateSync.ts index 552e0b99ded..1f0cf98be86 100644 --- a/src/vs/platform/userDataSync/common/globalStateSync.ts +++ b/src/vs/platform/userDataSync/common/globalStateSync.ts @@ -73,7 +73,7 @@ export class GlobalStateSynchroniser extends AbstractSynchroniser implements IUs /* Locale change */ Event.filter(fileService.onDidFilesChange, e => e.contains(this.environmentService.argvResource)), /* Global storage with user target has changed */ - Event.filter(storageService.onDidChangeStorage, e => e.scope === StorageScope.GLOBAL && e.target !== undefined ? e.target === StorageTarget.USER : storageService.keys(StorageScope.GLOBAL, StorageTarget.USER).includes(e.key)), + Event.filter(storageService.onDidChangeValue, e => e.scope === StorageScope.GLOBAL && e.target !== undefined ? e.target === StorageTarget.USER : storageService.keys(StorageScope.GLOBAL, StorageTarget.USER).includes(e.key)), /* Storage key target has changed */ this.storageService.onDidChangeTarget )((() => this.triggerLocalChange())) diff --git a/src/vs/platform/userDataSync/common/userDataAutoSyncService.ts b/src/vs/platform/userDataSync/common/userDataAutoSyncService.ts index 9af5f8f70ac..175566d511c 100644 --- a/src/vs/platform/userDataSync/common/userDataAutoSyncService.ts +++ b/src/vs/platform/userDataSync/common/userDataAutoSyncService.ts @@ -11,7 +11,7 @@ import { IUserDataSyncAccountService } from 'vs/platform/userDataSync/common/use import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { isPromiseCanceledError } from 'vs/base/common/errors'; import { CancellationToken } from 'vs/base/common/cancellation'; -import { IStorageService, StorageScope, IStorageChangeEvent } from 'vs/platform/storage/common/storage'; +import { IStorageService, StorageScope, IStorageValueChangeEvent } from 'vs/platform/storage/common/storage'; import { IEnvironmentService } from 'vs/platform/environment/common/environment'; import { IUserDataSyncMachinesService } from 'vs/platform/userDataSync/common/userDataSyncMachines'; import { localize } from 'vs/nls'; @@ -55,7 +55,7 @@ export class UserDataAutoSyncEnablementService extends Disposable implements _IU @IUserDataSyncStoreManagementService private readonly userDataSyncStoreManagementService: IUserDataSyncStoreManagementService, ) { super(); - this._register(storageService.onDidChangeStorage(e => this.onDidStorageChange(e))); + this._register(storageService.onDidChangeValue(e => this.onDidStorageChange(e))); } isEnabled(defaultEnablement?: boolean): boolean { @@ -76,7 +76,7 @@ export class UserDataAutoSyncEnablementService extends Disposable implements _IU this.storageService.store(enablementKey, enabled, StorageScope.GLOBAL); } - private onDidStorageChange(storageChangeEvent: IStorageChangeEvent): void { + private onDidStorageChange(storageChangeEvent: IStorageValueChangeEvent): void { if (storageChangeEvent.scope !== StorageScope.GLOBAL) { return; } diff --git a/src/vs/platform/userDataSync/common/userDataSyncResourceEnablementService.ts b/src/vs/platform/userDataSync/common/userDataSyncResourceEnablementService.ts index a59c4c51fd4..d5feb4fd146 100644 --- a/src/vs/platform/userDataSync/common/userDataSyncResourceEnablementService.ts +++ b/src/vs/platform/userDataSync/common/userDataSyncResourceEnablementService.ts @@ -6,7 +6,7 @@ import { IUserDataSyncResourceEnablementService, ALL_SYNC_RESOURCES, SyncResource } from 'vs/platform/userDataSync/common/userDataSync'; import { Disposable } from 'vs/base/common/lifecycle'; import { Emitter, Event } from 'vs/base/common/event'; -import { IStorageService, IStorageChangeEvent, StorageScope } from 'vs/platform/storage/common/storage'; +import { IStorageService, IStorageValueChangeEvent, StorageScope } from 'vs/platform/storage/common/storage'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; type SyncEnablementClassification = { @@ -28,7 +28,7 @@ export class UserDataSyncResourceEnablementService extends Disposable implements @ITelemetryService private readonly telemetryService: ITelemetryService, ) { super(); - this._register(storageService.onDidChangeStorage(e => this.onDidStorageChange(e))); + this._register(storageService.onDidChangeValue(e => this.onDidStorageChange(e))); } isResourceEnabled(resource: SyncResource): boolean { @@ -43,7 +43,7 @@ export class UserDataSyncResourceEnablementService extends Disposable implements } } - private onDidStorageChange(storageChangeEvent: IStorageChangeEvent): void { + private onDidStorageChange(storageChangeEvent: IStorageValueChangeEvent): void { if (storageChangeEvent.scope === StorageScope.GLOBAL) { const resourceKey = ALL_SYNC_RESOURCES.filter(resourceKey => getEnablementKey(resourceKey) === storageChangeEvent.key)[0]; if (resourceKey) { diff --git a/src/vs/workbench/api/browser/mainThreadStorage.ts b/src/vs/workbench/api/browser/mainThreadStorage.ts index 57abf0e86a5..987ca0788e1 100644 --- a/src/vs/workbench/api/browser/mainThreadStorage.ts +++ b/src/vs/workbench/api/browser/mainThreadStorage.ts @@ -27,7 +27,7 @@ export class MainThreadStorage implements MainThreadStorageShape { this._storageKeysSyncRegistryService = storageKeysSyncRegistryService; this._proxy = extHostContext.getProxy(ExtHostContext.ExtHostStorage); - this._storageListener = this._storageService.onDidChangeStorage(e => { + this._storageListener = this._storageService.onDidChangeValue(e => { const shared = e.scope === StorageScope.GLOBAL; if (shared && this._sharedStorageKeysToWatch.has(e.key)) { try { diff --git a/src/vs/workbench/browser/parts/activitybar/activitybarPart.ts b/src/vs/workbench/browser/parts/activitybar/activitybarPart.ts index 822cbcbfc45..66f4e39409f 100644 --- a/src/vs/workbench/browser/parts/activitybar/activitybarPart.ts +++ b/src/vs/workbench/browser/parts/activitybar/activitybarPart.ts @@ -19,7 +19,7 @@ import { ACTIVITY_BAR_BACKGROUND, ACTIVITY_BAR_BORDER, ACTIVITY_BAR_FOREGROUND, import { contrastBorder } from 'vs/platform/theme/common/colorRegistry'; import { CompositeBar, ICompositeBarItem, CompositeDragAndDrop } from 'vs/workbench/browser/parts/compositeBar'; import { Dimension, createCSSRule, asCSSUrl, addDisposableListener, EventType } from 'vs/base/browser/dom'; -import { IStorageService, StorageScope, IStorageChangeEvent, StorageTarget } from 'vs/platform/storage/common/storage'; +import { IStorageService, StorageScope, IStorageValueChangeEvent, StorageTarget } from 'vs/platform/storage/common/storage'; import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions'; import { URI, UriComponents } from 'vs/base/common/uri'; import { ToggleCompositePinnedAction, ICompositeBarColors, ActivityAction, ICompositeActivity } from 'vs/workbench/browser/parts/compositeBarActions'; @@ -247,7 +247,7 @@ export class ActivitybarPart extends Part implements IActivityBarService { disposables.clear(); this.onDidRegisterExtensions(); this.compositeBar.onDidChange(() => this.saveCachedViewContainers(), this, disposables); - this.storageService.onDidChangeStorage(e => this.onDidStorageChange(e), this, disposables); + this.storageService.onDidChangeValue(e => this.onDidStorageValueChange(e), this, disposables); })); // Register for configuration changes @@ -835,7 +835,7 @@ export class ActivitybarPart extends Part implements IActivityBarService { return this.viewDescriptorService.getViewContainersByLocation(this.location); } - private onDidStorageChange(e: IStorageChangeEvent): void { + private onDidStorageValueChange(e: IStorageValueChangeEvent): void { if (e.key === ActivitybarPart.PINNED_VIEW_CONTAINERS && e.scope === StorageScope.GLOBAL && this.pinnedViewContainersValue !== this.getStoredPinnedViewContainersValue() /* This checks if current window changed the value or not */) { this._pinnedViewContainersValue = undefined; diff --git a/src/vs/workbench/browser/parts/panel/panelPart.ts b/src/vs/workbench/browser/parts/panel/panelPart.ts index 2a8d7b4f7b6..b63b79614ef 100644 --- a/src/vs/workbench/browser/parts/panel/panelPart.ts +++ b/src/vs/workbench/browser/parts/panel/panelPart.ts @@ -13,7 +13,7 @@ import { CompositePart, ICompositeTitleLabel } from 'vs/workbench/browser/parts/ import { Panel, PanelRegistry, Extensions as PanelExtensions, PanelDescriptor } from 'vs/workbench/browser/panel'; import { IPanelService, IPanelIdentifier } from 'vs/workbench/services/panel/common/panelService'; import { IWorkbenchLayoutService, Parts, Position } from 'vs/workbench/services/layout/browser/layoutService'; -import { IStorageService, StorageScope, IStorageChangeEvent, StorageTarget } from 'vs/platform/storage/common/storage'; +import { IStorageService, StorageScope, IStorageValueChangeEvent, StorageTarget } from 'vs/platform/storage/common/storage'; import { IContextMenuService } from 'vs/platform/contextview/browser/contextView'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; @@ -335,7 +335,7 @@ export class PanelPart extends CompositePart implements IPanelService { disposables.clear(); this.onDidRegisterExtensions(); this.compositeBar.onDidChange(() => this.saveCachedPanels(), this, disposables); - this.storageService.onDidChangeStorage(e => this.onDidStorageChange(e), this, disposables); + this.storageService.onDidChangeValue(e => this.onDidStorageValueChange(e), this, disposables); })); } @@ -667,7 +667,7 @@ export class PanelPart extends CompositePart implements IPanelService { return this.toolBar.getItemsWidth(); } - private onDidStorageChange(e: IStorageChangeEvent): void { + private onDidStorageValueChange(e: IStorageValueChangeEvent): void { if (e.key === PanelPart.PINNED_PANELS && e.scope === StorageScope.GLOBAL && this.cachedPanelsValue !== this.getStoredCachedPanelsValue() /* This checks if current window changed the value or not */) { this._cachedPanelsValue = undefined; diff --git a/src/vs/workbench/browser/parts/statusbar/statusbarPart.ts b/src/vs/workbench/browser/parts/statusbar/statusbarPart.ts index 6181ede82d8..cdee7f68103 100644 --- a/src/vs/workbench/browser/parts/statusbar/statusbarPart.ts +++ b/src/vs/workbench/browser/parts/statusbar/statusbarPart.ts @@ -23,7 +23,7 @@ import { isThemeColor } from 'vs/editor/common/editorCommon'; import { Color } from 'vs/base/common/color'; import { EventHelper, createStyleSheet, addDisposableListener, EventType, hide, show, isAncestor, appendChildren } from 'vs/base/browser/dom'; import { INotificationService } from 'vs/platform/notification/common/notification'; -import { IStorageService, StorageScope, IStorageChangeEvent, StorageTarget } from 'vs/platform/storage/common/storage'; +import { IStorageService, StorageScope, IStorageValueChangeEvent, StorageTarget } from 'vs/platform/storage/common/storage'; import { Parts, IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService'; import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; import { coalesce } from 'vs/base/common/arrays'; @@ -101,10 +101,10 @@ class StatusbarViewModel extends Disposable { } private registerListeners(): void { - this._register(this.storageService.onDidChangeStorage(e => this.onDidStorageChange(e))); + this._register(this.storageService.onDidChangeValue(e => this.onDidStorageValueChange(e))); } - private onDidStorageChange(event: IStorageChangeEvent): void { + private onDidStorageValueChange(event: IStorageValueChangeEvent): void { if (event.key === StatusbarViewModel.HIDDEN_ENTRIES_KEY && event.scope === StorageScope.GLOBAL) { // Keep current hidden entries diff --git a/src/vs/workbench/services/extensionRecommendations/common/extensionIgnoredRecommendationsService.ts b/src/vs/workbench/services/extensionRecommendations/common/extensionIgnoredRecommendationsService.ts index 2f5ed993573..f77128e3dfc 100644 --- a/src/vs/workbench/services/extensionRecommendations/common/extensionIgnoredRecommendationsService.ts +++ b/src/vs/workbench/services/extensionRecommendations/common/extensionIgnoredRecommendationsService.ts @@ -7,7 +7,7 @@ import { distinct } from 'vs/base/common/arrays'; import { Emitter } from 'vs/base/common/event'; import { Disposable } from 'vs/base/common/lifecycle'; import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; -import { IStorageService, IStorageChangeEvent, StorageScope, StorageTarget } from 'vs/platform/storage/common/storage'; +import { IStorageService, IStorageValueChangeEvent, StorageScope, StorageTarget } from 'vs/platform/storage/common/storage'; import { IExtensionIgnoredRecommendationsService, IgnoredRecommendationChangeNotification } from 'vs/workbench/services/extensionRecommendations/common/extensionRecommendations'; import { IWorkpsaceExtensionsConfigService } from 'vs/workbench/services/extensionRecommendations/common/workspaceExtensionsConfig'; @@ -37,7 +37,7 @@ export class ExtensionIgnoredRecommendationsService extends Disposable implement ) { super(); this._globalIgnoredRecommendations = this.getCachedIgnoredRecommendations(); - this._register(this.storageService.onDidChangeStorage(e => this.onDidStorageChange(e))); + this._register(this.storageService.onDidChangeValue(e => this.onDidStorageChange(e))); this.initIgnoredWorkspaceRecommendations(); } @@ -69,7 +69,7 @@ export class ExtensionIgnoredRecommendationsService extends Disposable implement return ignoredRecommendations.map(e => e.toLowerCase()); } - private onDidStorageChange(e: IStorageChangeEvent): void { + private onDidStorageChange(e: IStorageValueChangeEvent): void { if (e.key === ignoredRecommendationsStorageKey && e.scope === StorageScope.GLOBAL && this.ignoredRecommendationsValue !== this.getStoredIgnoredRecommendationsValue() /* This checks if current window changed the value or not */) { this._ignoredRecommendationsValue = undefined; diff --git a/src/vs/workbench/services/userDataSync/browser/userDataSyncWorkbenchService.ts b/src/vs/workbench/services/userDataSync/browser/userDataSyncWorkbenchService.ts index 03eb9098b0f..53cd8dcd1d8 100644 --- a/src/vs/workbench/services/userDataSync/browser/userDataSyncWorkbenchService.ts +++ b/src/vs/workbench/services/userDataSync/browser/userDataSyncWorkbenchService.ts @@ -14,7 +14,7 @@ import { flatten, equals } from 'vs/base/common/arrays'; import { getCurrentAuthenticationSessionInfo, IAuthenticationService } from 'vs/workbench/services/authentication/browser/authenticationService'; import { IUserDataSyncAccountService } from 'vs/platform/userDataSync/common/userDataSyncAccount'; import { IQuickInputService, IQuickPickSeparator } from 'vs/platform/quickinput/common/quickInput'; -import { IStorageService, IStorageChangeEvent, StorageScope } from 'vs/platform/storage/common/storage'; +import { IStorageService, IStorageValueChangeEvent, StorageScope } from 'vs/platform/storage/common/storage'; import { ILogService } from 'vs/platform/log/common/log'; import { IProductService } from 'vs/platform/product/common/productService'; import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions'; @@ -175,7 +175,7 @@ export class UserDataSyncWorkbenchService extends Disposable implements IUserDat (() => this.update())); this._register(Event.filter(this.authenticationService.onDidChangeSessions, e => this.isSupportedAuthenticationProviderId(e.providerId))(({ event }) => this.onDidChangeSessions(event))); - this._register(this.storageService.onDidChangeStorage(e => this.onDidChangeStorage(e))); + this._register(this.storageService.onDidChangeValue(e => this.onDidChangeStorage(e))); this._register(Event.filter(this.userDataSyncAccountService.onTokenFailed, isSuccessive => isSuccessive)(() => this.onDidSuccessiveAuthFailures())); } @@ -584,7 +584,7 @@ export class UserDataSyncWorkbenchService extends Disposable implements IUserDat this.update(); } - private onDidChangeStorage(e: IStorageChangeEvent): void { + private onDidChangeStorage(e: IStorageValueChangeEvent): void { if (e.key === UserDataSyncWorkbenchService.CACHED_SESSION_STORAGE_KEY && e.scope === StorageScope.GLOBAL && this.currentSessionId !== this.getStoredCachedSessionId() /* This checks if current window changed the value or not */) { this._cachedCurrentSessionId = null; diff --git a/src/vs/workbench/services/views/browser/viewDescriptorService.ts b/src/vs/workbench/services/views/browser/viewDescriptorService.ts index f2d88b5a8e1..7087fc31c27 100644 --- a/src/vs/workbench/services/views/browser/viewDescriptorService.ts +++ b/src/vs/workbench/services/views/browser/viewDescriptorService.ts @@ -5,7 +5,7 @@ import { ViewContainerLocation, IViewDescriptorService, ViewContainer, IViewsRegistry, IViewContainersRegistry, IViewDescriptor, Extensions as ViewExtensions, ViewVisibilityState } from 'vs/workbench/common/views'; import { IContextKey, RawContextKey, IContextKeyService, ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey'; -import { IStorageService, StorageScope, IStorageChangeEvent, StorageTarget } from 'vs/platform/storage/common/storage'; +import { IStorageService, StorageScope, IStorageValueChangeEvent, StorageTarget } from 'vs/platform/storage/common/storage'; import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions'; import { Registry } from 'vs/platform/registry/common/platform'; import { toDisposable, DisposableStore, Disposable, IDisposable } from 'vs/base/common/lifecycle'; @@ -135,7 +135,7 @@ export class ViewDescriptorService extends Disposable implements IViewDescriptor this.viewContainerModels.clear(); })); - this._register(this.storageService.onDidChangeStorage((e) => { this.onDidStorageChange(e); })); + this._register(this.storageService.onDidChangeValue((e) => { this.onDidStorageChange(e); })); this._register(this.extensionService.onDidRegisterExtensions(() => this.onDidRegisterExtensions())); } @@ -501,7 +501,7 @@ export class ViewDescriptorService extends Disposable implements IViewDescriptor return new Map(JSON.parse(this.cachedViewContainerLocationsValue)); } - private onDidStorageChange(e: IStorageChangeEvent): void { + private onDidStorageChange(e: IStorageValueChangeEvent): void { if (e.key === ViewDescriptorService.CACHED_VIEW_POSITIONS && e.scope === StorageScope.GLOBAL && this.cachedViewPositionsValue !== this.getStoredCachedViewPositionsValue() /* This checks if current window changed the value or not */) { this._cachedViewPositionsValue = this.getStoredCachedViewPositionsValue(); diff --git a/src/vs/workbench/services/views/common/viewContainerModel.ts b/src/vs/workbench/services/views/common/viewContainerModel.ts index ded4501ff9b..1f8686f0c74 100644 --- a/src/vs/workbench/services/views/common/viewContainerModel.ts +++ b/src/vs/workbench/services/views/common/viewContainerModel.ts @@ -5,7 +5,7 @@ import { ViewContainer, IViewsRegistry, IViewDescriptor, Extensions as ViewExtensions, IViewContainerModel, IAddedViewDescriptorRef, IViewDescriptorRef, IAddedViewDescriptorState } from 'vs/workbench/common/views'; import { IContextKeyService, IReadableSet } from 'vs/platform/contextkey/common/contextkey'; -import { IStorageService, StorageScope, IStorageChangeEvent, StorageTarget } from 'vs/platform/storage/common/storage'; +import { IStorageService, StorageScope, IStorageValueChangeEvent, StorageTarget } from 'vs/platform/storage/common/storage'; import { Registry } from 'vs/platform/registry/common/platform'; import { Disposable } from 'vs/base/common/lifecycle'; import { Event, Emitter } from 'vs/base/common/event'; @@ -88,7 +88,7 @@ class ViewDescriptorsState extends Disposable { this.globalViewsStateStorageId = getViewsStateStorageId(viewContainerStorageId); this.workspaceViewsStateStorageId = viewContainerStorageId; - this._register(this.storageService.onDidChangeStorage(e => this.onDidStorageChange(e))); + this._register(this.storageService.onDidChangeValue(e => this.onDidStorageChange(e))); this.state = this.initialize(); } @@ -140,7 +140,7 @@ class ViewDescriptorsState extends Disposable { this.setStoredGlobalState(storedGlobalState); } - private onDidStorageChange(e: IStorageChangeEvent): void { + private onDidStorageChange(e: IStorageValueChangeEvent): void { if (e.key === this.globalViewsStateStorageId && e.scope === StorageScope.GLOBAL && this.globalViewsStatesValue !== this.getStoredGlobalViewsStatesValue() /* This checks if current window changed the value or not */) { this._globalViewsStatesValue = undefined; diff --git a/src/vs/workbench/services/workspaces/browser/workspacesService.ts b/src/vs/workbench/services/workspaces/browser/workspacesService.ts index 19985b8bc17..46b9066688e 100644 --- a/src/vs/workbench/services/workspaces/browser/workspacesService.ts +++ b/src/vs/workbench/services/workspaces/browser/workspacesService.ts @@ -43,7 +43,7 @@ export class BrowserWorkspacesService extends Disposable implements IWorkspacesS } private registerListeners(): void { - this._register(this.storageService.onDidChangeStorage(event => { + this._register(this.storageService.onDidChangeValue(event => { if (event.key === BrowserWorkspacesService.RECENTLY_OPENED_KEY && event.scope === StorageScope.GLOBAL) { this._onRecentlyOpenedChange.fire(); }