Skip to content

Commit cc5c103

Browse files
committed
debug: adopt to new taskIdentifier
1 parent deb7a38 commit cc5c103

3 files changed

Lines changed: 18 additions & 11 deletions

File tree

src/vs/workbench/parts/debug/common/debug.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import { IEditorService } from 'vs/workbench/services/editor/common/editorServic
2323
import { IDisposable } from 'vs/base/common/lifecycle';
2424
import { IViewContainersRegistry, ViewContainer, Extensions as ViewContainerExtensions } from 'vs/workbench/common/views';
2525
import { Registry } from 'vs/platform/registry/common/platform';
26+
import { TaskIdentifier } from 'vs/workbench/parts/tasks/common/tasks';
2627

2728
export const VIEWLET_ID = 'workbench.view.debug';
2829
export const VIEW_CONTAINER: ViewContainer = Registry.as<IViewContainersRegistry>(ViewContainerExtensions.ViewContainersRegistry).registerViewContainer(VIEWLET_ID);
@@ -372,8 +373,8 @@ export interface IGlobalConfig {
372373

373374
export interface IEnvConfig {
374375
internalConsoleOptions?: 'neverOpen' | 'openOnSessionStart' | 'openOnFirstSessionStart';
375-
preLaunchTask?: string;
376-
postDebugTask?: string;
376+
preLaunchTask?: string | TaskIdentifier;
377+
postDebugTask?: string | TaskIdentifier;
377378
debugServer?: number;
378379
noDebug?: boolean;
379380
}

src/vs/workbench/parts/debug/electron-browser/debugService.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ import { EXTENSION_LOG_BROADCAST_CHANNEL, EXTENSION_ATTACH_BROADCAST_CHANNEL, EX
4747
import { IBroadcastService, IBroadcast } from 'vs/platform/broadcast/electron-browser/broadcastService';
4848
import { IRemoteConsoleLog, parse, getFirstFrame } from 'vs/base/node/console';
4949
import { Source } from 'vs/workbench/parts/debug/common/debugSource';
50-
import { TaskEvent, TaskEventKind } from 'vs/workbench/parts/tasks/common/tasks';
50+
import { TaskEvent, TaskEventKind, TaskIdentifier } from 'vs/workbench/parts/tasks/common/tasks';
5151
import { IDialogService } from 'vs/platform/dialogs/common/dialogs';
5252
import { INotificationService } from 'vs/platform/notification/common/notification';
5353
import { IAction, Action } from 'vs/base/common/actions';
@@ -1029,16 +1029,16 @@ export class DebugService implements debug.IDebugService {
10291029
});
10301030
}
10311031

1032-
private runTask(sessionId: string, root: IWorkspaceFolder, taskName: string): TPromise<ITaskSummary> {
1033-
if (!taskName || this.skipRunningTask) {
1032+
private runTask(sessionId: string, root: IWorkspaceFolder, taskId: string | TaskIdentifier): TPromise<ITaskSummary> {
1033+
if (!taskId || this.skipRunningTask) {
10341034
this.skipRunningTask = false;
10351035
return TPromise.as(null);
10361036
}
1037-
10381037
// run a task before starting a debug session
1039-
return this.taskService.getTask(root, taskName).then(task => {
1038+
return this.taskService.getTask(root, taskId).then(task => {
1039+
const taskDisplayName = typeof taskId === 'string' ? `'${taskId}'` : nls.localize('specified', "specified");
10401040
if (!task) {
1041-
return TPromise.wrapError(errors.create(nls.localize('DebugTaskNotFound', "Could not find the task \'{0}\'.", taskName)));
1041+
return TPromise.wrapError(errors.create(nls.localize('DebugTaskNotFound', "Could not find the task {0}.", taskDisplayName)));
10421042
}
10431043

10441044
function once(kind: TaskEventKind, event: Event<TaskEvent>): Event<TaskEvent> {
@@ -1082,7 +1082,7 @@ export class DebugService implements debug.IDebugService {
10821082

10831083
setTimeout(() => {
10841084
if (!taskStarted) {
1085-
e({ severity: severity.Error, message: nls.localize('taskNotTracked', "The task '{0}' cannot be tracked.", taskName) });
1085+
e({ severity: severity.Error, message: nls.localize('taskNotTracked', "The task {0} cannot be tracked.", taskDisplayName) });
10861086
}
10871087
}, 10000);
10881088
});

src/vs/workbench/parts/debug/node/debugger.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import { TelemetryService } from 'vs/platform/telemetry/common/telemetryService'
2222
import uri from 'vs/base/common/uri';
2323
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
2424
import { memoize } from 'vs/base/common/decorators';
25+
import { TaskDefinitionRegistry } from 'vs/workbench/parts/tasks/common/taskDefinitionRegistry';
2526

2627
export class Debugger {
2728

@@ -207,6 +208,7 @@ export class Debugger {
207208
return null;
208209
}
209210
// fill in the default configuration attributes shared by all adapters.
211+
const taskSchema = TaskDefinitionRegistry.getJsonSchema();
210212
return Object.keys(this.debuggerContribution.configurationAttributes).map(request => {
211213
const attributes: IJSONSchema = this.debuggerContribution.configurationAttributes[request];
212214
const defaultRequired = ['name', 'type', 'request'];
@@ -239,12 +241,16 @@ export class Debugger {
239241
default: 4711
240242
};
241243
properties['preLaunchTask'] = {
242-
type: ['string', 'null'],
244+
anyOf: [taskSchema, {
245+
type: ['string', 'null'],
246+
}],
243247
default: '',
244248
description: nls.localize('debugPrelaunchTask', "Task to run before debug session starts.")
245249
};
246250
properties['postDebugTask'] = {
247-
type: ['string', 'null'],
251+
anyOf: [taskSchema, {
252+
type: ['string', 'null'],
253+
}],
248254
default: '',
249255
description: nls.localize('debugPostDebugTask', "Task to run after debug session ends.")
250256
};

0 commit comments

Comments
 (0)