From 325cb4a67d5f3ef38123d7e5e9e4a3e8a2d5f000 Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Tue, 27 Oct 2020 20:49:47 +0100 Subject: [PATCH] #95209 Move to final API --- src/vs/vscode.d.ts | 7 ++++++- src/vs/vscode.proposed.d.ts | 14 -------------- .../api/common/extHostExtensionService.ts | 1 - src/vs/workbench/api/common/extHostMemento.ts | 9 ++------- 4 files changed, 8 insertions(+), 23 deletions(-) diff --git a/src/vs/vscode.d.ts b/src/vs/vscode.d.ts index 266bface3da60..69f5969dfc415 100644 --- a/src/vs/vscode.d.ts +++ b/src/vs/vscode.d.ts @@ -5647,7 +5647,12 @@ declare module 'vscode' { * A memento object that stores state independent * of the current opened [workspace](#workspace.workspaceFolders). */ - readonly globalState: Memento; + readonly globalState: Memento & { + /** + * Set the keys whose values should be synced across devices when extensions synchronization is enabled. + */ + setKeysForSync(keys: string[]): void; + }; /** * The uri of the directory containing the extension. diff --git a/src/vs/vscode.proposed.d.ts b/src/vs/vscode.proposed.d.ts index 1911c769c3d43..b78140e70521b 100644 --- a/src/vs/vscode.proposed.d.ts +++ b/src/vs/vscode.proposed.d.ts @@ -2169,18 +2169,4 @@ declare module 'vscode' { } //#endregion - - //#region Syncing Extension's Global State https://github.com/microsoft/vscode/issues/95209 @sandy081 - export interface ExtensionContext { - - readonly syncedGlobalState: Memento & { - /** - * List of keys whose values should be synced across devices when extensions synchronization is enabled . - * Set synced keys to an empty array to unset the synced state. - */ - syncedKeys: ReadonlyArray; - }; - - } - //#endregion } diff --git a/src/vs/workbench/api/common/extHostExtensionService.ts b/src/vs/workbench/api/common/extHostExtensionService.ts index 0e6d982d02f7a..06aa1bf480d3f 100644 --- a/src/vs/workbench/api/common/extHostExtensionService.ts +++ b/src/vs/workbench/api/common/extHostExtensionService.ts @@ -387,7 +387,6 @@ export abstract class AbstractExtHostExtensionService extends Disposable impleme const that = this; return Object.freeze({ globalState, - get syncedGlobalState() { checkProposedApiEnabled(extensionDescription); return globalState; }, workspaceState, subscriptions: [], get extensionUri() { return extensionDescription.extensionLocation; }, diff --git a/src/vs/workbench/api/common/extHostMemento.ts b/src/vs/workbench/api/common/extHostMemento.ts index 97e17b832e3d5..bac8ab5fd3b70 100644 --- a/src/vs/workbench/api/common/extHostMemento.ts +++ b/src/vs/workbench/api/common/extHostMemento.ts @@ -7,7 +7,6 @@ import type * as vscode from 'vscode'; import { IDisposable } from 'vs/base/common/lifecycle'; import { ExtHostStorage } from 'vs/workbench/api/common/extHostStorage'; import { IExtensionDescription } from 'vs/platform/extensions/common/extensions'; -import { checkProposedApiEnabled } from 'vs/workbench/services/extensions/common/extensions'; export class ExtensionMemento implements vscode.Memento { @@ -64,12 +63,8 @@ export class ExtensionGlobalMemento extends ExtensionMemento { private readonly _extension: IExtensionDescription; - private _syncedKeys: string[] = []; - get syncedKeys(): ReadonlyArray { return Object.freeze(this._syncedKeys); } - set syncedKeys(syncKeys: ReadonlyArray) { - checkProposedApiEnabled(this._extension); - this._syncedKeys = [...syncKeys]; - this._storage.registerExtensionStorageKeysToSync({ id: this._id, version: this._extension.version }, this._syncedKeys); + setKeysForSync(keys: string[]): void { + this._storage.registerExtensionStorageKeysToSync({ id: this._id, version: this._extension.version }, keys); } constructor(extensionDescription: IExtensionDescription, storage: ExtHostStorage) {