Skip to content

Commit

Permalink
Revert "Queue all parts of debug start that can require user input (#… (
Browse files Browse the repository at this point in the history
#159594)

Revert "Queue all parts of debug start that can require user input (#158439)"

This reverts commit 0dddb85.
  • Loading branch information
roblourens authored Aug 30, 2022
1 parent e1131f9 commit 58a6c3e
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/vs/workbench/contrib/debug/browser/debugService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import * as aria from 'vs/base/browser/ui/aria/aria';
import { Action, IAction } from 'vs/base/common/actions';
import { distinct } from 'vs/base/common/arrays';
import { Queue, raceTimeout, RunOnceScheduler } from 'vs/base/common/async';
import { raceTimeout, RunOnceScheduler } from 'vs/base/common/async';
import { CancellationTokenSource } from 'vs/base/common/cancellation';
import { isErrorWithActions } from 'vs/base/common/errorMessage';
import * as errors from 'vs/base/common/errors';
Expand Down Expand Up @@ -85,8 +85,6 @@ export class DebugService implements IDebugService {
private activity: IDisposable | undefined;
private chosenEnvironments: { [key: string]: string };

private configResolverQueue = new Queue<IConfig | null | undefined>();

constructor(
@IEditorService private readonly editorService: IEditorService,
@IPaneCompositePartService private readonly paneCompositeService: IPaneCompositePartService,
Expand Down Expand Up @@ -447,7 +445,7 @@ export class DebugService implements IDebugService {
const sessionId = generateUuid();
this.sessionCancellationTokens.set(sessionId, initCancellationToken);

const configByProviders = await this.configResolverQueue.queue(() => this.configurationManager.resolveConfigurationByProviders(launch && launch.workspace ? launch.workspace.uri : undefined, type, config!, initCancellationToken.token));
const configByProviders = await this.configurationManager.resolveConfigurationByProviders(launch && launch.workspace ? launch.workspace.uri : undefined, type, config!, initCancellationToken.token);
// a falsy config indicates an aborted launch
if (configByProviders && configByProviders.type) {
try {
Expand All @@ -468,7 +466,7 @@ export class DebugService implements IDebugService {
return false;
}

const cfg = await this.configResolverQueue.queue(() => this.configurationManager.resolveDebugConfigurationWithSubstitutedVariables(launch && launch.workspace ? launch.workspace.uri : undefined, type, resolvedConfig!, initCancellationToken.token));
const cfg = await this.configurationManager.resolveDebugConfigurationWithSubstitutedVariables(launch && launch.workspace ? launch.workspace.uri : undefined, type, resolvedConfig, initCancellationToken.token);
if (!cfg) {
if (launch && type && cfg === null && !initCancellationToken.token.isCancellationRequested) { // show launch.json only for "config" being "null".
await launch.openConfigFile({ preserveFocus: true, type }, initCancellationToken.token);
Expand Down Expand Up @@ -753,11 +751,11 @@ export class DebugService implements IDebugService {
if (launch && needsToSubstitute && unresolved) {
const initCancellationToken = new CancellationTokenSource();
this.sessionCancellationTokens.set(session.getId(), initCancellationToken);
const resolvedByProviders = await this.configResolverQueue.queue(() => this.configurationManager.resolveConfigurationByProviders(launch.workspace ? launch.workspace.uri : undefined, unresolved!.type, unresolved!, initCancellationToken.token));
const resolvedByProviders = await this.configurationManager.resolveConfigurationByProviders(launch.workspace ? launch.workspace.uri : undefined, unresolved.type, unresolved, initCancellationToken.token);
if (resolvedByProviders) {
resolved = await this.substituteVariables(launch, resolvedByProviders);
if (resolved && !initCancellationToken.token.isCancellationRequested) {
resolved = await this.configResolverQueue.queue(() => this.configurationManager.resolveDebugConfigurationWithSubstitutedVariables(launch && launch.workspace ? launch.workspace.uri : undefined, unresolved!.type, resolved!, initCancellationToken.token));
resolved = await this.configurationManager.resolveDebugConfigurationWithSubstitutedVariables(launch && launch.workspace ? launch.workspace.uri : undefined, unresolved.type, resolved, initCancellationToken.token);
}
} else {
resolved = resolvedByProviders;
Expand Down Expand Up @@ -824,7 +822,7 @@ export class DebugService implements IDebugService {
return Promise.all(sessions.map(s => disconnect ? s.disconnect(undefined, suspend) : s.terminate()));
}

private async substituteVariables(launch: ILaunch | undefined, config: IConfig): Promise<IConfig | null | undefined> {
private async substituteVariables(launch: ILaunch | undefined, config: IConfig): Promise<IConfig | undefined> {
const dbg = this.adapterManager.getDebugger(config.type);
if (dbg) {
let folder: IWorkspaceFolder | undefined = undefined;
Expand All @@ -837,7 +835,7 @@ export class DebugService implements IDebugService {
}
}
try {
return this.configResolverQueue.queue(() => dbg.substituteVariables(folder, config));
return await dbg.substituteVariables(folder, config);
} catch (err) {
this.showError(err.message, undefined, !!launch?.getConfiguration(config.name));
return undefined; // bail out
Expand Down

0 comments on commit 58a6c3e

Please sign in to comment.