Skip to content

Commit bbf7f6c

Browse files
author
Benjamin Pasero
committed
storage sync - adopt a few to be syced (microsoft#93332)
1 parent daa4a61 commit bbf7f6c

3 files changed

Lines changed: 22 additions & 6 deletions

File tree

src/vs/platform/quickinput/browser/commandsQuickAccess.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
2121
import { isPromiseCanceledError } from 'vs/base/common/errors';
2222
import { INotificationService } from 'vs/platform/notification/common/notification';
2323
import { toErrorMessage } from 'vs/base/common/errorMessage';
24+
import { IStorageKeysSyncRegistryService } from 'vs/platform/userDataSync/common/storageKeys';
2425

2526
export interface ICommandQuickPick extends IPickerQuickAccessItem {
2627
commandId: string;
@@ -202,10 +203,15 @@ export class CommandsHistory extends Disposable {
202203

203204
constructor(
204205
@IStorageService private readonly storageService: IStorageService,
205-
@IConfigurationService private readonly configurationService: IConfigurationService
206+
@IConfigurationService private readonly configurationService: IConfigurationService,
207+
@IStorageKeysSyncRegistryService storageKeysSyncRegistryService: IStorageKeysSyncRegistryService
206208
) {
207209
super();
208210

211+
// opt-in to syncing
212+
storageKeysSyncRegistryService.registerStorageKey({ key: CommandsHistory.PREF_KEY_CACHE, version: 1 });
213+
storageKeysSyncRegistryService.registerStorageKey({ key: CommandsHistory.PREF_KEY_COUNTER, version: 1 });
214+
209215
this.updateConfiguration();
210216
this.load();
211217

src/vs/workbench/contrib/files/browser/editors/textFileSaveErrorHandler.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import { isWindows } from 'vs/base/common/platform';
3232
import { Schemas } from 'vs/base/common/network';
3333
import { IPreferencesService } from 'vs/workbench/services/preferences/common/preferences';
3434
import { SaveReason } from 'vs/workbench/common/editor';
35+
import { IStorageKeysSyncRegistryService } from 'vs/platform/userDataSync/common/storageKeys';
3536

3637
export const CONFLICT_RESOLUTION_CONTEXT = 'saveConflictResolutionContext';
3738
export const CONFLICT_RESOLUTION_SCHEME = 'conflictResolution';
@@ -53,10 +54,14 @@ export class TextFileSaveErrorHandler extends Disposable implements ISaveErrorHa
5354
@IEditorService private readonly editorService: IEditorService,
5455
@ITextModelService textModelService: ITextModelService,
5556
@IInstantiationService private readonly instantiationService: IInstantiationService,
56-
@IStorageService private readonly storageService: IStorageService
57+
@IStorageService private readonly storageService: IStorageService,
58+
@IStorageKeysSyncRegistryService storageKeysSyncRegistryService: IStorageKeysSyncRegistryService
5759
) {
5860
super();
5961

62+
// opt-in to syncing
63+
storageKeysSyncRegistryService.registerStorageKey({ key: LEARN_MORE_DIRTY_WRITE_IGNORE_KEY, version: 1 });
64+
6065
this.messages = new ResourceMap<INotificationHandle>();
6166
this.conflictResolutionContext = new RawContextKey<boolean>(CONFLICT_RESOLUTION_CONTEXT, false).bindTo(contextKeyService);
6267

src/vs/workbench/services/workspaces/browser/workspacesService.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
77
import { IWorkspacesService, IWorkspaceFolderCreationData, IWorkspaceIdentifier, IEnterWorkspaceResult, IRecentlyOpened, restoreRecentlyOpened, IRecent, isRecentFile, isRecentFolder, toStoreData, IStoredWorkspaceFolder, getStoredWorkspaceFolder, WORKSPACE_EXTENSION, IStoredWorkspace } from 'vs/platform/workspaces/common/workspaces';
88
import { URI } from 'vs/base/common/uri';
9-
import { Event, Emitter } from 'vs/base/common/event';
9+
import { Emitter } from 'vs/base/common/event';
1010
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
1111
import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace';
1212
import { ILogService } from 'vs/platform/log/common/log';
@@ -16,25 +16,30 @@ import { IFileService, FileOperationError, FileOperationResult } from 'vs/platfo
1616
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
1717
import { joinPath } from 'vs/base/common/resources';
1818
import { VSBuffer } from 'vs/base/common/buffer';
19+
import { IStorageKeysSyncRegistryService } from 'vs/platform/userDataSync/common/storageKeys';
1920

2021
export class BrowserWorkspacesService extends Disposable implements IWorkspacesService {
2122

2223
static readonly RECENTLY_OPENED_KEY = 'recently.opened';
2324

2425
_serviceBrand: undefined;
2526

26-
private readonly _onRecentlyOpenedChange: Emitter<void> = this._register(new Emitter<void>());
27-
readonly onRecentlyOpenedChange: Event<void> = this._onRecentlyOpenedChange.event;
27+
private readonly _onRecentlyOpenedChange = this._register(new Emitter<void>());
28+
readonly onRecentlyOpenedChange = this._onRecentlyOpenedChange.event;
2829

2930
constructor(
3031
@IStorageService private readonly storageService: IStorageService,
3132
@IWorkspaceContextService private readonly workspaceService: IWorkspaceContextService,
3233
@ILogService private readonly logService: ILogService,
3334
@IFileService private readonly fileService: IFileService,
34-
@IWorkbenchEnvironmentService private readonly environmentService: IWorkbenchEnvironmentService
35+
@IWorkbenchEnvironmentService private readonly environmentService: IWorkbenchEnvironmentService,
36+
@IStorageKeysSyncRegistryService storageKeysSyncRegistryService: IStorageKeysSyncRegistryService
3537
) {
3638
super();
3739

40+
// opt-in to syncing
41+
storageKeysSyncRegistryService.registerStorageKey({ key: BrowserWorkspacesService.RECENTLY_OPENED_KEY, version: 1 });
42+
3843
// Opening a workspace should push it as most
3944
// recently used to the workspaces history
4045
this.addWorkspaceToRecentlyOpened();

0 commit comments

Comments
 (0)