From ee19568ac426f3afceead48f2381ddf81095c87c Mon Sep 17 00:00:00 2001 From: Andre Weinand Date: Tue, 7 Jan 2020 10:53:38 +0100 Subject: [PATCH] honor cancellationToken; fixes #88173 --- .../contrib/debug/browser/debugService.ts | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/vs/workbench/contrib/debug/browser/debugService.ts b/src/vs/workbench/contrib/debug/browser/debugService.ts index 215e33e08a5..30098061097 100644 --- a/src/vs/workbench/contrib/debug/browser/debugService.ts +++ b/src/vs/workbench/contrib/debug/browser/debugService.ts @@ -380,16 +380,20 @@ export class DebugService implements IDebugService { if (configByProviders && configByProviders.type) { try { let resolvedConfig = await this.substituteVariables(launch, configByProviders); - if (!resolvedConfig) { - // User canceled resolving of interactive variables, silently return + // User cancelled resolving of interactive variables, silently return + return false; + } + + if (!this.initCancellationToken) { + // User cancelled, silently return return false; } const cfg = await this.configurationManager.resolveDebugConfigurationWithSubstitutedVariables(launch && launch.workspace ? launch.workspace.uri : undefined, type, resolvedConfig, this.initCancellationToken.token); if (!cfg) { - if (launch && type && cfg === null) { // show launch.json only for "config" being "null". - await launch.openConfigFile(false, true, type, this.initCancellationToken ? this.initCancellationToken.token : undefined); + if (launch && type && cfg === null && this.initCancellationToken) { // show launch.json only for "config" being "null". + await launch.openConfigFile(false, true, type, this.initCancellationToken.token); } return false; } @@ -422,16 +426,16 @@ export class DebugService implements IDebugService { } else if (this.contextService.getWorkbenchState() === WorkbenchState.EMPTY) { await this.showError(nls.localize('noFolderWorkspaceDebugError', "The active file can not be debugged. Make sure it is saved and that you have a debug extension installed for that file type.")); } - if (launch) { - await launch.openConfigFile(false, true, undefined, this.initCancellationToken ? this.initCancellationToken.token : undefined); + if (launch && this.initCancellationToken) { + await launch.openConfigFile(false, true, undefined, this.initCancellationToken.token); } return false; } } - if (launch && type && configByProviders === null) { // show launch.json only for "config" being "null". - await launch.openConfigFile(false, true, type, this.initCancellationToken ? this.initCancellationToken.token : undefined); + if (launch && type && configByProviders === null && this.initCancellationToken) { // show launch.json only for "config" being "null". + await launch.openConfigFile(false, true, type, this.initCancellationToken.token); } return false; @@ -648,7 +652,7 @@ export class DebugService implements IDebugService { const resolvedByProviders = await this.configurationManager.resolveConfigurationByProviders(launch.workspace ? launch.workspace.uri : undefined, unresolved.type, unresolved, this.initCancellationToken.token); if (resolvedByProviders) { resolved = await this.substituteVariables(launch, resolvedByProviders); - if (resolved) { + if (resolved && this.initCancellationToken) { resolved = await this.configurationManager.resolveDebugConfigurationWithSubstitutedVariables(launch && launch.workspace ? launch.workspace.uri : undefined, unresolved.type, resolved, this.initCancellationToken.token); } } else {