Merge from vscode 64980ea1f3f532c82bb6c28d27bba9ef2c5b4463 (#7206)

* Merge from vscode 64980ea1f3f532c82bb6c28d27bba9ef2c5b4463

* fix config changes

* fix strictnull checks
This commit is contained in:
Anthony Dresser
2019-09-15 22:38:26 -07:00
committed by GitHub
parent fa6c52699e
commit ea0f9e6ce9
1226 changed files with 21541 additions and 17633 deletions

View File

@@ -42,11 +42,11 @@ export interface IConfigOptions<T> {
* - configurable defaults
*/
export class ConfigWatcher<T> extends Disposable implements IConfigWatcher<T> {
private cache: T;
private parseErrors: json.ParseError[];
private disposed: boolean;
private loaded: boolean;
private timeoutHandle: NodeJS.Timer | null;
private cache: T | undefined;
private parseErrors: json.ParseError[] | undefined;
private disposed: boolean | undefined;
private loaded: boolean | undefined;
private timeoutHandle: NodeJS.Timer | null | undefined;
private readonly _onDidUpdateConfiguration: Emitter<IConfigurationChangeEvent<T>>;
constructor(private _path: string, private options: IConfigOptions<T> = { defaultConfig: Object.create(null), onError: error => console.error(error) }) {
@@ -62,7 +62,7 @@ export class ConfigWatcher<T> extends Disposable implements IConfigWatcher<T> {
}
get hasParseErrors(): boolean {
return this.parseErrors && this.parseErrors.length > 0;
return !!this.parseErrors && this.parseErrors.length > 0;
}
get onDidUpdateConfiguration(): Event<IConfigurationChangeEvent<T>> {
@@ -161,7 +161,7 @@ export class ConfigWatcher<T> extends Disposable implements IConfigWatcher<T> {
if (!objects.equals(currentConfig, this.cache)) {
this.updateCache(currentConfig);
this._onDidUpdateConfiguration.fire({ config: this.cache });
this._onDidUpdateConfiguration.fire({ config: currentConfig });
}
if (callback) {
@@ -173,7 +173,7 @@ export class ConfigWatcher<T> extends Disposable implements IConfigWatcher<T> {
getConfig(): T {
this.ensureLoaded();
return this.cache;
return this.cache!;
}
private ensureLoaded(): void {
@@ -186,4 +186,4 @@ export class ConfigWatcher<T> extends Disposable implements IConfigWatcher<T> {
this.disposed = true;
super.dispose();
}
}
}

View File

@@ -268,10 +268,10 @@ function factory(nodeRequire, path, fs, perf) {
const packData = JSON.parse(values[1]).contents;
const bundles = Object.keys(metadata.bundles);
const writes = [];
for (let bundle of bundles) {
for (const bundle of bundles) {
const modules = metadata.bundles[bundle];
const target = Object.create(null);
for (let module of modules) {
for (const module of modules) {
const keys = metadata.keys[module];
const defaultMessages = metadata.messages[module];
const translations = packData[module];