提交 a09175a5 编写于 作者: B Benjamin Pasero

real fix for #66986

上级 7a9f7e5e
...@@ -375,7 +375,7 @@ class StorageManager extends Disposable { ...@@ -375,7 +375,7 @@ class StorageManager extends Disposable {
} }
private _get(key: string, scope: StorageScope): string { private _get(key: string, scope: StorageScope): string {
return this.storageService.get(key, scope, '[]') || '[]'; return this.storageService.get(key, scope, '[]');
} }
private _set(key: string, value: string | undefined, scope: StorageScope): void { private _set(key: string, value: string | undefined, scope: StorageScope): void {
......
...@@ -67,8 +67,8 @@ export interface IStorageService { ...@@ -67,8 +67,8 @@ export interface IStorageService {
* The scope argument allows to define the scope of the storage * The scope argument allows to define the scope of the storage
* operation to either the current workspace only or all workspaces. * operation to either the current workspace only or all workspaces.
*/ */
getInteger<R extends number | undefined>(key: string, scope: StorageScope, fallbackValue: number): number; getInteger(key: string, scope: StorageScope, fallbackValue: number): number;
getInteger<R extends number | undefined>(key: string, scope: StorageScope, fallbackValue?: number): number | undefined; getInteger(key: string, scope: StorageScope, fallbackValue?: number): number | undefined;
/** /**
* Store a value under the given key to storage. The value will be converted to a string. * Store a value under the given key to storage. The value will be converted to a string.
......
...@@ -57,7 +57,7 @@ export class GlobalStorageDatabaseChannel extends Disposable implements IServerC ...@@ -57,7 +57,7 @@ export class GlobalStorageDatabaseChannel extends Disposable implements IServerC
private serializeEvents(events: IStorageChangeEvent[]): ISerializableItemsChangeEvent { private serializeEvents(events: IStorageChangeEvent[]): ISerializableItemsChangeEvent {
const items = new Map<Key, Value>(); const items = new Map<Key, Value>();
events.forEach(event => items.set(event.key, this.storageMainService.get(event.key, ''))); events.forEach(event => items.set(event.key, this.storageMainService.get(event.key)));
return { items: mapToSerializable(items) } as ISerializableItemsChangeEvent; return { items: mapToSerializable(items) } as ISerializableItemsChangeEvent;
} }
......
...@@ -39,6 +39,7 @@ export interface IStorageMainService { ...@@ -39,6 +39,7 @@ export interface IStorageMainService {
* the provided defaultValue if the element is null or undefined. * the provided defaultValue if the element is null or undefined.
*/ */
get(key: string, fallbackValue: string): string; get(key: string, fallbackValue: string): string;
get(key: string, fallbackValue?: string): string | undefined;
/** /**
* Retrieve an element stored with the given key from storage. Use * Retrieve an element stored with the given key from storage. Use
...@@ -46,6 +47,7 @@ export interface IStorageMainService { ...@@ -46,6 +47,7 @@ export interface IStorageMainService {
* will be converted to a boolean. * will be converted to a boolean.
*/ */
getBoolean(key: string, fallbackValue: boolean): boolean; getBoolean(key: string, fallbackValue: boolean): boolean;
getBoolean(key: string, fallbackValue?: boolean): boolean | undefined;
/** /**
* Retrieve an element stored with the given key from storage. Use * Retrieve an element stored with the given key from storage. Use
...@@ -53,6 +55,7 @@ export interface IStorageMainService { ...@@ -53,6 +55,7 @@ export interface IStorageMainService {
* will be converted to a number using parseInt with a base of 10. * will be converted to a number using parseInt with a base of 10.
*/ */
getInteger(key: string, fallbackValue: number): number; getInteger(key: string, fallbackValue: number): number;
getInteger(key: string, fallbackValue?: number): number | undefined;
/** /**
* Store a string value under the given key to storage. The value will * Store a string value under the given key to storage. The value will
...@@ -345,15 +348,21 @@ export class StorageMainService extends Disposable implements IStorageMainServic ...@@ -345,15 +348,21 @@ export class StorageMainService extends Disposable implements IStorageMainServic
}); });
} }
get(key: string, fallbackValue: string): string { get(key: string, fallbackValue: string): string;
get(key: string, fallbackValue?: string): string | undefined;
get(key: string, fallbackValue?: string): string | undefined {
return this.storage.get(key, fallbackValue); return this.storage.get(key, fallbackValue);
} }
getBoolean(key: string, fallbackValue: boolean): boolean { getBoolean(key: string, fallbackValue: boolean): boolean;
getBoolean(key: string, fallbackValue?: boolean): boolean | undefined;
getBoolean(key: string, fallbackValue?: boolean): boolean | undefined {
return this.storage.getBoolean(key, fallbackValue); return this.storage.getBoolean(key, fallbackValue);
} }
getInteger(key: string, fallbackValue: number): number { getInteger(key: string, fallbackValue: number): number;
getInteger(key: string, fallbackValue?: number): number | undefined;
getInteger(key: string, fallbackValue?: number): number | undefined {
return this.storage.getInteger(key, fallbackValue); return this.storage.getInteger(key, fallbackValue);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册