Skip to content

Commit

Permalink
Finalize task detail API
Browse files Browse the repository at this point in the history
Fixes #69785
  • Loading branch information
alexr00 committed Aug 27, 2020
1 parent 0eb11e8 commit 0de8d51
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 18 deletions.
2 changes: 1 addition & 1 deletion extensions/npm/src/npmView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { JSONVisitor, visit } from 'jsonc-parser';
import * as path from 'path';
import {
commands, Event, EventEmitter, ExtensionContext,
Selection, Task2 as Task,
Selection, Task,
TaskGroup, tasks, TextDocument, ThemeIcon, TreeDataProvider, TreeItem, TreeItemCollapsibleState, Uri,
window, workspace, WorkspaceFolder
} from 'vscode';
Expand Down
2 changes: 1 addition & 1 deletion extensions/npm/src/tasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/

import {
TaskDefinition, Task2 as Task, TaskGroup, WorkspaceFolder, RelativePattern, ShellExecution, Uri, workspace,
TaskDefinition, Task, TaskGroup, WorkspaceFolder, RelativePattern, ShellExecution, Uri, workspace,
DebugConfiguration, debug, TaskProvider, TextDocument, tasks, TaskScope, QuickPickItem
} from 'vscode';
import * as path from 'path';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ class TscTaskProvider implements vscode.TaskProvider {
}

private getBuildTask(workspaceFolder: vscode.WorkspaceFolder | undefined, label: string, command: string, args: string[], buildTaskidentifier: TypeScriptTaskDefinition): vscode.Task {
const buildTask = new vscode.Task2(
const buildTask = new vscode.Task(
buildTaskidentifier,
workspaceFolder || vscode.TaskScope.Workspace,
localize('buildTscLabel', 'build - {0}', label),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/

import * as assert from 'assert';
import { window, tasks, Disposable, TaskDefinition, Task, EventEmitter, CustomExecution, Pseudoterminal, TaskScope, commands, Task2, env, UIKind, ShellExecution, TaskExecution, Terminal, Event } from 'vscode';
import { window, tasks, Disposable, TaskDefinition, Task, EventEmitter, CustomExecution, Pseudoterminal, TaskScope, commands, env, UIKind, ShellExecution, TaskExecution, Terminal, Event } from 'vscode';

// Disable tasks tests:
// - Web https://github.com/microsoft/vscode/issues/90528
Expand Down Expand Up @@ -94,7 +94,7 @@ import { window, tasks, Disposable, TaskDefinition, Task, EventEmitter, CustomEx
};
return Promise.resolve(pty);
});
const task = new Task2(kind, TaskScope.Workspace, taskName, taskType, execution);
const task = new Task(kind, TaskScope.Workspace, taskName, taskType, execution);
result.push(task);
return result;
},
Expand Down Expand Up @@ -151,7 +151,7 @@ import { window, tasks, Disposable, TaskDefinition, Task, EventEmitter, CustomEx
};
return Promise.resolve(pty);
});
const task = new Task2(kind, TaskScope.Workspace, taskName, taskType, execution);
const task = new Task(kind, TaskScope.Workspace, taskName, taskType, execution);
result.push(task);
return result;
},
Expand Down
5 changes: 5 additions & 0 deletions src/vs/vscode.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6205,6 +6205,11 @@ declare module 'vscode' {
*/
name: string;

/**
* A detail to show for the task on a second line in places where the task's name is displayed.
*/
detail?: string;

/**
* The task's execution engine
*/
Expand Down
7 changes: 0 additions & 7 deletions src/vs/vscode.proposed.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -963,13 +963,6 @@ declare module 'vscode' {
}
//#endregion

/**
* A task to execute
*/
export class Task2 extends Task {
detail?: string;
}

//#region Task presentation group: https://github.com/microsoft/vscode/issues/47265
export interface TaskPresentationOptions {
/**
Expand Down
1 change: 0 additions & 1 deletion src/vs/workbench/api/common/extHost.api.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1098,7 +1098,6 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
SymbolKind: extHostTypes.SymbolKind,
SymbolTag: extHostTypes.SymbolTag,
Task: extHostTypes.Task,
Task2: extHostTypes.Task,
TaskGroup: extHostTypes.TaskGroup,
TaskPanelKind: extHostTypes.TaskPanelKind,
TaskRevealKind: extHostTypes.TaskRevealKind,
Expand Down
4 changes: 2 additions & 2 deletions src/vs/workbench/api/common/extHostTask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,8 @@ export namespace TaskDTO {
presentationOptions: TaskPresentationOptionsDTO.from(value.presentationOptions),
problemMatchers: value.problemMatchers,
hasDefinedMatchers: (value as types.Task).hasDefinedMatchers,
runOptions: (<vscode.Task>value).runOptions ? (<vscode.Task>value).runOptions : { reevaluateOnRerun: true },
detail: (<vscode.Task2>value).detail
runOptions: value.runOptions ? value.runOptions : { reevaluateOnRerun: true },
detail: value.detail
};
return result;
}
Expand Down
2 changes: 1 addition & 1 deletion src/vs/workbench/api/common/extHostTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1875,7 +1875,7 @@ export class CustomExecution implements vscode.CustomExecution {
}

@es5ClassCompat
export class Task implements vscode.Task2 {
export class Task implements vscode.Task {

private static ExtensionCallbackType: string = 'customExecution';
private static ProcessType: string = 'process';
Expand Down
2 changes: 1 addition & 1 deletion src/vs/workbench/api/node/extHostTask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export class ExtHostTask extends ExtHostTaskBase {
// The ID is calculated on the main thread task side, so, let's call into it here.
// We need the task id's pre-computed for custom task executions because when OnDidStartTask
// is invoked, we have to be able to map it back to our data.
taskIdPromises.push(this.addCustomExecution(taskDTO, <vscode.Task2>task, true));
taskIdPromises.push(this.addCustomExecution(taskDTO, task, true));
}
}
}
Expand Down

0 comments on commit 0de8d51

Please sign in to comment.