- move migration into a util function

- extract extension storage methods to a separate service
This commit is contained in:
Sandeep Somavarapu
2022-01-08 00:36:52 +01:00
parent 8e658894e9
commit 2766a74d2a
12 changed files with 277 additions and 245 deletions

View File

@@ -7,7 +7,7 @@ import { MainContext, MainThreadStorageShape, ExtHostStorageShape } from './extH
import { Emitter } from 'vs/base/common/event';
import { IExtHostRpcService } from 'vs/workbench/api/common/extHostRpcService';
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
import { IExtensionIdWithVersion } from 'vs/platform/userDataSync/common/extensionsStorageSync';
import { IExtensionIdWithVersion } from 'vs/platform/extensionManagement/common/extensionStorage';
export interface IStorageChangeEvent {
shared: boolean;
@@ -32,8 +32,8 @@ export class ExtHostStorage implements ExtHostStorageShape {
this._proxy.$registerExtensionStorageKeysToSync(extension, keys);
}
getValue<T>(shared: boolean, key: string, defaultValue?: T): Promise<T | undefined> {
return this._proxy.$getValue<T>(shared, key).then(value => value || defaultValue);
initializeExtensionStorage(shared: boolean, key: string, defaultValue?: object): Promise<object | undefined> {
return this._proxy.$initializeExtensionStorage(shared, key).then(value => value || defaultValue);
}
setValue(shared: boolean, key: string, value: object): Promise<void> {