From 780a5085d7d007ca7bec68daf4ddcde870556e05 Mon Sep 17 00:00:00 2001 From: Alex Ross Date: Mon, 5 Aug 2019 14:38:04 +0200 Subject: [PATCH] Strict init for tasks, file picker, and custom view Part of #78168 --- .../workbench/api/browser/mainThreadTask.ts | 2 +- .../workbench/api/common/extHostTreeViews.ts | 14 +++++----- .../tasks/node/processRunnerDetector.ts | 14 +++++----- .../dialogs/browser/remoteFileDialog.ts | 28 +++++++++---------- 4 files changed, 29 insertions(+), 29 deletions(-) diff --git a/src/vs/workbench/api/browser/mainThreadTask.ts b/src/vs/workbench/api/browser/mainThreadTask.ts index dbc3da9fafd..3e022e13cab 100644 --- a/src/vs/workbench/api/browser/mainThreadTask.ts +++ b/src/vs/workbench/api/browser/mainThreadTask.ts @@ -420,7 +420,7 @@ namespace TaskFilterDTO { @extHostNamedCustomer(MainContext.MainThreadTask) export class MainThreadTask implements MainThreadTaskShape { - private readonly _extHostContext: IExtHostContext; + private readonly _extHostContext: IExtHostContext | undefined; private readonly _proxy: ExtHostTaskShape; private readonly _providers: Map; diff --git a/src/vs/workbench/api/common/extHostTreeViews.ts b/src/vs/workbench/api/common/extHostTreeViews.ts index bd3b82994d5..6b5d8d02c58 100644 --- a/src/vs/workbench/api/common/extHostTreeViews.ts +++ b/src/vs/workbench/api/common/extHostTreeViews.ts @@ -247,7 +247,7 @@ class ExtHostTreeView extends Disposable { .then(treeNode => this.proxy.$reveal(this.viewId, treeNode.item, parentChain.map(p => p.item), { select, focus, expand })), error => this.logService.error(error)); } - private _message: string | MarkdownString; + private _message: string | MarkdownString = ''; get message(): string | MarkdownString { return this._message; } @@ -565,9 +565,9 @@ class ExtHostTreeView extends Disposable { if (node) { if (node.children) { for (const child of node.children) { - const childEleement = this.elements.get(child.item.handle); - if (childEleement) { - this.clear(childEleement); + const childElement = this.elements.get(child.item.handle); + if (childElement) { + this.clear(childElement); } } } @@ -583,9 +583,9 @@ class ExtHostTreeView extends Disposable { if (node) { if (node.children) { for (const child of node.children) { - const childEleement = this.elements.get(child.item.handle); - if (childEleement) { - this.clear(childEleement); + const childElement = this.elements.get(child.item.handle); + if (childElement) { + this.clear(childElement); } } } diff --git a/src/vs/workbench/contrib/tasks/node/processRunnerDetector.ts b/src/vs/workbench/contrib/tasks/node/processRunnerDetector.ts index 85b3465b41b..538cb57ad6c 100644 --- a/src/vs/workbench/contrib/tasks/node/processRunnerDetector.ts +++ b/src/vs/workbench/contrib/tasks/node/processRunnerDetector.ts @@ -59,9 +59,9 @@ class RegexpTaskMatcher implements TaskDetectorMatcher { } class GruntTaskMatcher implements TaskDetectorMatcher { - private tasksStart: boolean; - private tasksEnd: boolean; - private descriptionOffset: number | null; + private tasksStart!: boolean; + private tasksEnd!: boolean; + private descriptionOffset!: number | null; init() { this.tasksStart = false; @@ -179,7 +179,7 @@ export class ProcessRunnerDetector { commandExecutable, isShellCommand, config.matcher, ProcessRunnerDetector.DefaultProblemMatchers, list)); } else { if (detectSpecific) { - let detectorPromise: Promise; + let detectorPromise: Promise; if ('gulp' === detectSpecific) { detectorPromise = this.tryDetectGulp(this._workspaceRoot, list); } else if ('jake' === detectSpecific) { @@ -229,7 +229,7 @@ export class ProcessRunnerDetector { return result; } - private tryDetectGulp(workspaceFolder: IWorkspaceFolder, list: boolean): Promise { + private tryDetectGulp(workspaceFolder: IWorkspaceFolder, list: boolean): Promise { return Promise.resolve(this.fileService.resolve(workspaceFolder.toResource('gulpfile.js'))).then((stat) => { // TODO@Dirk (https://github.com/Microsoft/vscode/issues/29454) let config = ProcessRunnerDetector.detectorConfig('gulp'); let process = new LineProcess('gulp', [config.arg, '--no-color'], true, { cwd: this._cwd }); @@ -239,7 +239,7 @@ export class ProcessRunnerDetector { }); } - private tryDetectGrunt(workspaceFolder: IWorkspaceFolder, list: boolean): Promise { + private tryDetectGrunt(workspaceFolder: IWorkspaceFolder, list: boolean): Promise { return Promise.resolve(this.fileService.resolve(workspaceFolder.toResource('Gruntfile.js'))).then((stat) => { // TODO@Dirk (https://github.com/Microsoft/vscode/issues/29454) let config = ProcessRunnerDetector.detectorConfig('grunt'); let process = new LineProcess('grunt', [config.arg, '--no-color'], true, { cwd: this._cwd }); @@ -249,7 +249,7 @@ export class ProcessRunnerDetector { }); } - private tryDetectJake(workspaceFolder: IWorkspaceFolder, list: boolean): Promise { + private tryDetectJake(workspaceFolder: IWorkspaceFolder, list: boolean): Promise { let run = () => { let config = ProcessRunnerDetector.detectorConfig('jake'); let process = new LineProcess('jake', [config.arg], true, { cwd: this._cwd }); diff --git a/src/vs/workbench/services/dialogs/browser/remoteFileDialog.ts b/src/vs/workbench/services/dialogs/browser/remoteFileDialog.ts index 7c70bf3fecb..696f4681b4e 100644 --- a/src/vs/workbench/services/dialogs/browser/remoteFileDialog.ts +++ b/src/vs/workbench/services/dialogs/browser/remoteFileDialog.ts @@ -46,24 +46,24 @@ enum UpdateResult { } export class RemoteFileDialog { - private options: IOpenDialogOptions; - private currentFolder: URI; - private filePickBox: IQuickPick; - private hidden: boolean; - private allowFileSelection: boolean; - private allowFolderSelection: boolean; + private options!: IOpenDialogOptions; + private currentFolder!: URI; + private filePickBox!: IQuickPick; + private hidden: boolean = false; + private allowFileSelection: boolean = true; + private allowFolderSelection: boolean = false; private remoteAuthority: string | undefined; - private requiresTrailing: boolean; + private requiresTrailing: boolean = false; private trailing: string | undefined; private scheme: string = REMOTE_HOST_SCHEME; private contextKey: IContextKey; - private userEnteredPathSegment: string; - private autoCompletePathSegment: string; - private activeItem: FileQuickPickItem; - private userHome: URI; + private userEnteredPathSegment: string = ''; + private autoCompletePathSegment: string = ''; + private activeItem: FileQuickPickItem | undefined; + private userHome!: URI; private badPath: string | undefined; - private remoteAgentEnvironment: IRemoteAgentEnvironment | null; - private separator: string; + private remoteAgentEnvironment: IRemoteAgentEnvironment | null | undefined; + private separator: string = '/'; private onBusyChangeEmitter = new Emitter(); private updatingPromise: CancelablePromise | undefined; @@ -865,4 +865,4 @@ export class RemoteFileDialog { return undefined; } } -} \ No newline at end of file +}