mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-24 18:49:00 +01:00
- move migration into a util function
- extract extension storage methods to a separate service
This commit is contained in:
@@ -41,7 +41,7 @@ import { ClassifiedEvent, GDPRClassification, StrictPropertyCheck } from 'vs/pla
|
||||
import { ITelemetryInfo } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { ICreateContributedTerminalProfileOptions, IProcessProperty, IShellLaunchConfigDto, ITerminalEnvironment, ITerminalLaunchError, ITerminalProfile, TerminalLocation } from 'vs/platform/terminal/common/terminal';
|
||||
import { ThemeColor, ThemeIcon } from 'vs/platform/theme/common/themeService';
|
||||
import { IExtensionIdWithVersion } from 'vs/platform/userDataSync/common/extensionsStorageSync';
|
||||
import { IExtensionIdWithVersion } from 'vs/platform/extensionManagement/common/extensionStorage';
|
||||
import { WorkspaceTrustRequestOptions } from 'vs/platform/workspace/common/workspaceTrust';
|
||||
import { ExtensionActivationReason } from 'vs/workbench/api/common/extHostExtensionActivator';
|
||||
import { ExtHostInteractive } from 'vs/workbench/api/common/extHostInteractive';
|
||||
@@ -610,8 +610,8 @@ export interface MainThreadStatusBarShape extends IDisposable {
|
||||
}
|
||||
|
||||
export interface MainThreadStorageShape extends IDisposable {
|
||||
$getValue<T>(shared: boolean, key: string): Promise<T | undefined>;
|
||||
$setValue(shared: boolean, key: string, value: object): Promise<void>;
|
||||
$initializeExtensionStorage(shared: boolean, extensionId: string): Promise<object | undefined>;
|
||||
$setValue(shared: boolean, extensionId: string, value: object): Promise<void>;
|
||||
$registerExtensionStorageKeysToSync(extension: IExtensionIdWithVersion, keys: string[]): void;
|
||||
}
|
||||
|
||||
@@ -2101,7 +2101,7 @@ export interface ExtHostInteractiveShape {
|
||||
}
|
||||
|
||||
export interface ExtHostStorageShape {
|
||||
$acceptValue(shared: boolean, key: string, value: object | undefined): void;
|
||||
$acceptValue(shared: boolean, extensionId: string, value: object | undefined): void;
|
||||
}
|
||||
|
||||
export interface ExtHostThemingShape {
|
||||
|
||||
@@ -27,7 +27,7 @@ export class ExtensionMemento implements vscode.Memento {
|
||||
this._shared = global;
|
||||
this._storage = storage;
|
||||
|
||||
this._init = this._storage.getValue(this._shared, this._id, Object.create(null)).then(value => {
|
||||
this._init = this._storage.initializeExtensionStorage(this._shared, this._id, Object.create(null)).then(value => {
|
||||
this._value = value;
|
||||
return this;
|
||||
});
|
||||
|
||||
@@ -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> {
|
||||
|
||||
Reference in New Issue
Block a user