Merge from vscode 2b0b9136329c181a9e381463a1f7dc3a2d105a34 (#4880)

This commit is contained in:
Karl Burtram
2019-04-05 10:09:18 -07:00
committed by GitHub
parent 9bd7e30d18
commit cb5bcf2248
433 changed files with 8915 additions and 8361 deletions

View File

@@ -6,11 +6,10 @@
import * as path from 'vs/base/common/path';
import * as fs from 'fs';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { writeFileAndFlushSync } from 'vs/base/node/extfs';
import { writeFileSync, readFile } from 'vs/base/node/pfs';
import { isUndefined, isUndefinedOrNull } from 'vs/base/common/types';
import { IStateService } from 'vs/platform/state/common/state';
import { ILogService } from 'vs/platform/log/common/log';
import { readFile } from 'vs/base/node/pfs';
export class FileStorage {
@@ -69,7 +68,7 @@ export class FileStorage {
return res;
}
setItem(key: string, data: any): void {
setItem(key: string, data?: object | string | number | boolean | undefined | null): void {
// Remove an item when it is undefined or null
if (isUndefinedOrNull(data)) {
@@ -103,7 +102,7 @@ export class FileStorage {
}
try {
writeFileAndFlushSync(this.dbPath, serializedDatabase); // permission issue can happen here
writeFileSync(this.dbPath, serializedDatabase); // permission issue can happen here
this.lastFlushedSerializedDatabase = serializedDatabase;
} catch (error) {
this.onError(error);
@@ -136,7 +135,7 @@ export class StateService implements IStateService {
return this.fileStorage.getItem(key, defaultValue);
}
setItem(key: string, data: any): void {
setItem(key: string, data?: object | string | number | boolean | undefined | null): void {
this.fileStorage.setItem(key, data);
}