Skip to content

Commit a09175a

Browse files
author
Benjamin Pasero
committed
real fix for microsoft#66986
1 parent 7a9f7e5 commit a09175a

4 files changed

Lines changed: 16 additions & 7 deletions

File tree

src/vs/platform/extensionManagement/common/extensionEnablementService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ class StorageManager extends Disposable {
375375
}
376376

377377
private _get(key: string, scope: StorageScope): string {
378-
return this.storageService.get(key, scope, '[]') || '[]';
378+
return this.storageService.get(key, scope, '[]');
379379
}
380380

381381
private _set(key: string, value: string | undefined, scope: StorageScope): void {

src/vs/platform/storage/common/storage.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ export interface IStorageService {
6767
* The scope argument allows to define the scope of the storage
6868
* operation to either the current workspace only or all workspaces.
6969
*/
70-
getInteger<R extends number | undefined>(key: string, scope: StorageScope, fallbackValue: number): number;
71-
getInteger<R extends number | undefined>(key: string, scope: StorageScope, fallbackValue?: number): number | undefined;
70+
getInteger(key: string, scope: StorageScope, fallbackValue: number): number;
71+
getInteger(key: string, scope: StorageScope, fallbackValue?: number): number | undefined;
7272

7373
/**
7474
* Store a value under the given key to storage. The value will be converted to a string.

src/vs/platform/storage/node/storageIpc.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export class GlobalStorageDatabaseChannel extends Disposable implements IServerC
5757

5858
private serializeEvents(events: IStorageChangeEvent[]): ISerializableItemsChangeEvent {
5959
const items = new Map<Key, Value>();
60-
events.forEach(event => items.set(event.key, this.storageMainService.get(event.key, '')));
60+
events.forEach(event => items.set(event.key, this.storageMainService.get(event.key)));
6161

6262
return { items: mapToSerializable(items) } as ISerializableItemsChangeEvent;
6363
}

src/vs/platform/storage/node/storageMainService.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,23 @@ export interface IStorageMainService {
3939
* the provided defaultValue if the element is null or undefined.
4040
*/
4141
get(key: string, fallbackValue: string): string;
42+
get(key: string, fallbackValue?: string): string | undefined;
4243

4344
/**
4445
* Retrieve an element stored with the given key from storage. Use
4546
* the provided defaultValue if the element is null or undefined. The element
4647
* will be converted to a boolean.
4748
*/
4849
getBoolean(key: string, fallbackValue: boolean): boolean;
50+
getBoolean(key: string, fallbackValue?: boolean): boolean | undefined;
4951

5052
/**
5153
* Retrieve an element stored with the given key from storage. Use
5254
* the provided defaultValue if the element is null or undefined. The element
5355
* will be converted to a number using parseInt with a base of 10.
5456
*/
5557
getInteger(key: string, fallbackValue: number): number;
58+
getInteger(key: string, fallbackValue?: number): number | undefined;
5659

5760
/**
5861
* Store a string value under the given key to storage. The value will
@@ -345,15 +348,21 @@ export class StorageMainService extends Disposable implements IStorageMainServic
345348
});
346349
}
347350

348-
get(key: string, fallbackValue: string): string {
351+
get(key: string, fallbackValue: string): string;
352+
get(key: string, fallbackValue?: string): string | undefined;
353+
get(key: string, fallbackValue?: string): string | undefined {
349354
return this.storage.get(key, fallbackValue);
350355
}
351356

352-
getBoolean(key: string, fallbackValue: boolean): boolean {
357+
getBoolean(key: string, fallbackValue: boolean): boolean;
358+
getBoolean(key: string, fallbackValue?: boolean): boolean | undefined;
359+
getBoolean(key: string, fallbackValue?: boolean): boolean | undefined {
353360
return this.storage.getBoolean(key, fallbackValue);
354361
}
355362

356-
getInteger(key: string, fallbackValue: number): number {
363+
getInteger(key: string, fallbackValue: number): number;
364+
getInteger(key: string, fallbackValue?: number): number | undefined;
365+
getInteger(key: string, fallbackValue?: number): number | undefined {
357366
return this.storage.getInteger(key, fallbackValue);
358367
}
359368

0 commit comments

Comments
 (0)