diff --git a/src/tsconfig.strictNullChecks.json b/src/tsconfig.strictNullChecks.json index 87b49357ed4..55c52fe5b61 100644 --- a/src/tsconfig.strictNullChecks.json +++ b/src/tsconfig.strictNullChecks.json @@ -66,6 +66,7 @@ "./vs/base/common/jsonFormatter.ts", "./vs/base/common/paths.ts", "./vs/base/common/uriIpc.ts", + "./vs/base/node/config.ts", "./vs/base/node/console.ts", "./vs/base/node/crypto.ts", "./vs/base/node/decoder.ts", @@ -94,6 +95,7 @@ "./vs/base/parts/ipc/test/node/testApp.ts", "./vs/base/parts/ipc/test/node/testService.ts", "./vs/base/parts/quickopen/common/quickOpen.ts", + "./vs/base/parts/quickopen/common/quickOpenScorer.ts", "./vs/base/test/browser/ui/grid/util.ts", "./vs/base/test/common/json.test.ts", "./vs/base/test/common/jsonEdit.test.ts", @@ -468,6 +470,12 @@ "./vs/platform/quickOpen/common/quickOpen.ts", "./vs/platform/quickinput/common/quickInput.ts", "./vs/platform/registry/common/platform.ts", + "./vs/platform/remote/common/remoteAuthorityResolver.ts", + "./vs/platform/remote/common/remoteHosts.ts", + "./vs/platform/remote/node/remoteAgentConnection.ts", + "./vs/platform/remote/node/remoteAgentFileSystemChannel.ts", + "./vs/platform/remote/node/remoteAuthorityResolverChannel.ts", + "./vs/platform/remote/node/remoteAuthorityResolverService.ts", "./vs/platform/request/electron-browser/requestService.ts", "./vs/platform/request/electron-main/requestService.ts", "./vs/platform/request/node/request.ts", @@ -652,10 +660,13 @@ "./vs/workbench/services/keybinding/common/macLinuxFallbackKeyboardMapper.ts", "./vs/workbench/services/keybinding/common/macLinuxKeyboardMapper.ts", "./vs/workbench/services/keybinding/common/windowsKeyboardMapper.ts", + "./vs/workbench/services/keybinding/electron-browser/keybindingService.ts", "./vs/workbench/services/mode/common/workbenchModeService.ts", "./vs/workbench/services/notification/common/notificationService.ts", "./vs/workbench/services/panel/common/panelService.ts", "./vs/workbench/services/part/common/partService.ts", + "./vs/workbench/services/remote/node/remoteAgentEnvironmentChannel.ts", + "./vs/workbench/services/remote/node/remoteAgentService.ts", "./vs/workbench/services/scm/common/scm.ts", "./vs/workbench/services/scm/common/scmService.ts", "./vs/workbench/services/search/common/searchHelpers.ts", @@ -680,8 +691,7 @@ "./vs/workbench/services/themes/common/workbenchThemeService.ts", "./vs/workbench/services/title/common/titleService.ts", "./vs/workbench/services/workspace/common/workspaceEditing.ts", - "./vs/workbench/test/electron-browser/api/mock.ts", - "./vs/base/parts/quickopen/common/quickOpenScorer.ts" + "./vs/workbench/test/electron-browser/api/mock.ts" ], "exclude": [ "./typings/require-monaco.d.ts", diff --git a/src/vs/base/node/config.ts b/src/vs/base/node/config.ts index b9be322eaa9..2632980f8cb 100644 --- a/src/vs/base/node/config.ts +++ b/src/vs/base/node/config.ts @@ -13,7 +13,7 @@ import * as extfs from 'vs/base/node/extfs'; import { isWindows } from 'vs/base/common/platform'; export interface IConfigurationChangeEvent { - config: T; + config?: T; } export interface IConfigWatcher { @@ -21,8 +21,8 @@ export interface IConfigWatcher { hasParseErrors: boolean; reload(callback: (config: T) => void): void; - getConfig(): T; - getValue(key: string, fallback?: V): V; + getConfig(): T | undefined; + getValue(key: string, fallback?: V): V | undefined; } export interface IConfigOptions { @@ -30,7 +30,7 @@ export interface IConfigOptions { defaultConfig?: T; changeBufferDelay?: number; parse?: (content: string, errors: any[]) => T; - initCallback?: (config: T) => void; + initCallback?: (config: T | undefined) => void; } /** @@ -42,11 +42,11 @@ export interface IConfigOptions { * - configurable defaults */ export class ConfigWatcher implements IConfigWatcher, IDisposable { - private cache: T; + private cache?: T; private parseErrors: json.ParseError[]; private disposed: boolean; private loaded: boolean; - private timeoutHandle: NodeJS.Timer; + private timeoutHandle: any; private disposables: IDisposable[]; private readonly _onDidUpdateConfiguration: Emitter>; private configName: string; @@ -85,12 +85,12 @@ export class ConfigWatcher implements IConfigWatcher, IDisposable { }); } - private updateCache(value: T): void { + private updateCache(value: T | undefined): void { this.cache = value; this.loaded = true; } - private loadSync(): T { + private loadSync(): T | undefined { try { return this.parse(fs.readFileSync(this._path).toString()); } catch (error) { @@ -98,7 +98,7 @@ export class ConfigWatcher implements IConfigWatcher, IDisposable { } } - private loadAsync(callback: (config: T) => void): void { + private loadAsync(callback: (config: T | undefined) => void): void { fs.readFile(this._path, (error, raw) => { if (error) { return callback(this.options.defaultConfig); @@ -108,8 +108,8 @@ export class ConfigWatcher implements IConfigWatcher, IDisposable { }); } - private parse(raw: string): T { - let res: T; + private parse(raw: string): T | undefined { + let res: T | undefined; try { this.parseErrors = []; res = this.options.parse ? this.options.parse(raw, this.parseErrors) : json.parse(raw, this.parseErrors); @@ -156,7 +156,7 @@ export class ConfigWatcher implements IConfigWatcher, IDisposable { )); } - private onConfigFileChange(eventType: string, filename: string, isParentFolder: boolean): void { + private onConfigFileChange(eventType: string, filename: string | undefined, isParentFolder: boolean): void { if (isParentFolder) { // Windows: in some cases the filename contains artifacts from the absolute path @@ -177,10 +177,10 @@ export class ConfigWatcher implements IConfigWatcher, IDisposable { } // we can get multiple change events for one change, so we buffer through a timeout - this.timeoutHandle = global.setTimeout(() => this.reload(), this.options.changeBufferDelay); + this.timeoutHandle = global.setTimeout(() => this.reload(), this.options.changeBufferDelay || 0); } - public reload(callback?: (config: T) => void): void { + public reload(callback?: (config: T | undefined) => void): void { this.loadAsync(currentConfig => { if (!objects.equals(currentConfig, this.cache)) { this.updateCache(currentConfig); @@ -194,13 +194,13 @@ export class ConfigWatcher implements IConfigWatcher, IDisposable { }); } - public getConfig(): T { + public getConfig(): T | undefined { this.ensureLoaded(); return this.cache; } - public getValue(key: string, fallback?: V): V { + public getValue(key: string, fallback?: V): V | undefined { this.ensureLoaded(); if (!key) {