Skip to content

Commit

Permalink
228640: Hiding prelaunch task popup if the setting to hide it is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
Parasaran-Python committed Oct 13, 2024
1 parent 104d04f commit cd711b2
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 24 deletions.
5 changes: 5 additions & 0 deletions src/vs/workbench/contrib/debug/browser/debug.contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,11 @@ configurationRegistry.registerConfiguration({
type: 'boolean',
markdownDescription: nls.localize({ comment: ['This is the description for a setting'], key: 'debug.hideLauncherWhileDebugging' }, "Hide 'Start Debugging' control in title bar of 'Run and Debug' view while debugging is active. Only relevant when {0} is not `docked`.", '`#debug.toolBarLocation#`'),
default: false
},
'debug.hidePreLaunchNotification': {
type: 'boolean',
description: nls.localize('debug.hidePreLaunchNotification', "Hide preLaunchTask popup."),
default: false
}
}
});
Expand Down
51 changes: 27 additions & 24 deletions src/vs/workbench/contrib/debug/browser/debugTaskRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,33 +286,36 @@ export class DebugTaskRunner implements IDisposable {
}
}, waitTime));

// Notification shown on any task taking a while to resolve
store.add(disposableTimeout(() => {
const message = nls.localize('runningTask', "Waiting for preLaunchTask '{0}'...", task.configurationProperties.name);
const buttons = [DEBUG_ANYWAY_LABEL_NO_MEMO, ABORT_LABEL];
const canConfigure = task instanceof CustomTask || task instanceof ConfiguringTask;
if (canConfigure) {
buttons.splice(1, 0, nls.localize('configureTask', "Configure Task"));
}
const hidePreLaunchNotification = this.configurationService.getValue<IDebugConfiguration>('debug').hidePreLaunchNotification;
if (!hidePreLaunchNotification) {
// Notification shown on any task taking a while to resolve
store.add(disposableTimeout(() => {
const message = nls.localize('runningTask', "Waiting for preLaunchTask '{0}'...", task.configurationProperties.name);
const buttons = [DEBUG_ANYWAY_LABEL_NO_MEMO, ABORT_LABEL];
const canConfigure = task instanceof CustomTask || task instanceof ConfiguringTask;
if (canConfigure) {
buttons.splice(1, 0, nls.localize('configureTask', "Configure Task"));
}

this.progressService.withProgress(
{ location: ProgressLocation.Notification, title: message, buttons },
() => result.catch(() => { }),
(choice) => {
if (choice === undefined) {
// no-op, keep waiting
} else if (choice === 0) { // debug anyway
resolve({ exitCode: 0 });
} else { // abort or configure
resolve({ exitCode: undefined, cancelled: true });
this.taskService.terminate(task).catch(() => { });
if (canConfigure && choice === 1) { // configure
this.taskService.openConfig(task as CustomTask);
this.progressService.withProgress(
{ location: ProgressLocation.Notification, title: message, buttons },
() => result.catch(() => { }),
(choice) => {
if (choice === undefined) {
// no-op, keep waiting
} else if (choice === 0) { // debug anyway
resolve({ exitCode: 0 });
} else { // abort or configure
resolve({ exitCode: undefined, cancelled: true });
this.taskService.terminate(task).catch(() => { });
if (canConfigure && choice === 1) { // configure
this.taskService.openConfig(task as CustomTask);
}
}
}
}
);
}, 10_000));
);
}, 10_000));
}
}));
});

Expand Down
1 change: 1 addition & 0 deletions src/vs/workbench/contrib/debug/common/debug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -814,6 +814,7 @@ export interface IDebugConfiguration {
autoExpandLazyVariables: 'auto' | 'off' | 'on';
enableStatusBarColor: boolean;
showVariableTypes: boolean;
hidePreLaunchNotification: boolean;
}

export interface IGlobalConfig {
Expand Down

0 comments on commit cd711b2

Please sign in to comment.