提交 cc5c1030 编写于 作者: I isidor

debug: adopt to new taskIdentifier

上级 deb7a38b
......@@ -23,6 +23,7 @@ import { IEditorService } from 'vs/workbench/services/editor/common/editorServic
import { IDisposable } from 'vs/base/common/lifecycle';
import { IViewContainersRegistry, ViewContainer, Extensions as ViewContainerExtensions } from 'vs/workbench/common/views';
import { Registry } from 'vs/platform/registry/common/platform';
import { TaskIdentifier } from 'vs/workbench/parts/tasks/common/tasks';
export const VIEWLET_ID = 'workbench.view.debug';
export const VIEW_CONTAINER: ViewContainer = Registry.as<IViewContainersRegistry>(ViewContainerExtensions.ViewContainersRegistry).registerViewContainer(VIEWLET_ID);
......@@ -372,8 +373,8 @@ export interface IGlobalConfig {
export interface IEnvConfig {
internalConsoleOptions?: 'neverOpen' | 'openOnSessionStart' | 'openOnFirstSessionStart';
preLaunchTask?: string;
postDebugTask?: string;
preLaunchTask?: string | TaskIdentifier;
postDebugTask?: string | TaskIdentifier;
debugServer?: number;
noDebug?: boolean;
}
......
......@@ -47,7 +47,7 @@ import { EXTENSION_LOG_BROADCAST_CHANNEL, EXTENSION_ATTACH_BROADCAST_CHANNEL, EX
import { IBroadcastService, IBroadcast } from 'vs/platform/broadcast/electron-browser/broadcastService';
import { IRemoteConsoleLog, parse, getFirstFrame } from 'vs/base/node/console';
import { Source } from 'vs/workbench/parts/debug/common/debugSource';
import { TaskEvent, TaskEventKind } from 'vs/workbench/parts/tasks/common/tasks';
import { TaskEvent, TaskEventKind, TaskIdentifier } from 'vs/workbench/parts/tasks/common/tasks';
import { IDialogService } from 'vs/platform/dialogs/common/dialogs';
import { INotificationService } from 'vs/platform/notification/common/notification';
import { IAction, Action } from 'vs/base/common/actions';
......@@ -1029,16 +1029,16 @@ export class DebugService implements debug.IDebugService {
});
}
private runTask(sessionId: string, root: IWorkspaceFolder, taskName: string): TPromise<ITaskSummary> {
if (!taskName || this.skipRunningTask) {
private runTask(sessionId: string, root: IWorkspaceFolder, taskId: string | TaskIdentifier): TPromise<ITaskSummary> {
if (!taskId || this.skipRunningTask) {
this.skipRunningTask = false;
return TPromise.as(null);
}
// run a task before starting a debug session
return this.taskService.getTask(root, taskName).then(task => {
return this.taskService.getTask(root, taskId).then(task => {
const taskDisplayName = typeof taskId === 'string' ? `'${taskId}'` : nls.localize('specified', "specified");
if (!task) {
return TPromise.wrapError(errors.create(nls.localize('DebugTaskNotFound', "Could not find the task \'{0}\'.", taskName)));
return TPromise.wrapError(errors.create(nls.localize('DebugTaskNotFound', "Could not find the task {0}.", taskDisplayName)));
}
function once(kind: TaskEventKind, event: Event<TaskEvent>): Event<TaskEvent> {
......@@ -1082,7 +1082,7 @@ export class DebugService implements debug.IDebugService {
setTimeout(() => {
if (!taskStarted) {
e({ severity: severity.Error, message: nls.localize('taskNotTracked', "The task '{0}' cannot be tracked.", taskName) });
e({ severity: severity.Error, message: nls.localize('taskNotTracked', "The task {0} cannot be tracked.", taskDisplayName) });
}
}, 10000);
});
......
......@@ -22,6 +22,7 @@ import { TelemetryService } from 'vs/platform/telemetry/common/telemetryService'
import uri from 'vs/base/common/uri';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { memoize } from 'vs/base/common/decorators';
import { TaskDefinitionRegistry } from 'vs/workbench/parts/tasks/common/taskDefinitionRegistry';
export class Debugger {
......@@ -207,6 +208,7 @@ export class Debugger {
return null;
}
// fill in the default configuration attributes shared by all adapters.
const taskSchema = TaskDefinitionRegistry.getJsonSchema();
return Object.keys(this.debuggerContribution.configurationAttributes).map(request => {
const attributes: IJSONSchema = this.debuggerContribution.configurationAttributes[request];
const defaultRequired = ['name', 'type', 'request'];
......@@ -239,12 +241,16 @@ export class Debugger {
default: 4711
};
properties['preLaunchTask'] = {
type: ['string', 'null'],
anyOf: [taskSchema, {
type: ['string', 'null'],
}],
default: '',
description: nls.localize('debugPrelaunchTask', "Task to run before debug session starts.")
};
properties['postDebugTask'] = {
type: ['string', 'null'],
anyOf: [taskSchema, {
type: ['string', 'null'],
}],
default: '',
description: nls.localize('debugPostDebugTask', "Task to run after debug session ends.")
};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册