Finalize task detail API

Fixes #69785
This commit is contained in:
Alex Ross 2020-08-27 11:07:20 +02:00
parent 0eb11e8f0c
commit 0de8d51904
10 changed files with 15 additions and 18 deletions

View file

@ -7,7 +7,7 @@ import { JSONVisitor, visit } from 'jsonc-parser';
import * as path from 'path'; import * as path from 'path';
import { import {
commands, Event, EventEmitter, ExtensionContext, commands, Event, EventEmitter, ExtensionContext,
Selection, Task2 as Task, Selection, Task,
TaskGroup, tasks, TextDocument, ThemeIcon, TreeDataProvider, TreeItem, TreeItemCollapsibleState, Uri, TaskGroup, tasks, TextDocument, ThemeIcon, TreeDataProvider, TreeItem, TreeItemCollapsibleState, Uri,
window, workspace, WorkspaceFolder window, workspace, WorkspaceFolder
} from 'vscode'; } from 'vscode';

View file

@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
import { 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 DebugConfiguration, debug, TaskProvider, TextDocument, tasks, TaskScope, QuickPickItem
} from 'vscode'; } from 'vscode';
import * as path from 'path'; import * as path from 'path';

View file

@ -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 { 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, buildTaskidentifier,
workspaceFolder || vscode.TaskScope.Workspace, workspaceFolder || vscode.TaskScope.Workspace,
localize('buildTscLabel', 'build - {0}', label), localize('buildTscLabel', 'build - {0}', label),

View file

@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
import * as assert from 'assert'; 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: // Disable tasks tests:
// - Web https://github.com/microsoft/vscode/issues/90528 // - Web https://github.com/microsoft/vscode/issues/90528
@ -94,7 +94,7 @@ import { window, tasks, Disposable, TaskDefinition, Task, EventEmitter, CustomEx
}; };
return Promise.resolve(pty); 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); result.push(task);
return result; return result;
}, },
@ -151,7 +151,7 @@ import { window, tasks, Disposable, TaskDefinition, Task, EventEmitter, CustomEx
}; };
return Promise.resolve(pty); 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); result.push(task);
return result; return result;
}, },

5
src/vs/vscode.d.ts vendored
View file

@ -6205,6 +6205,11 @@ declare module 'vscode' {
*/ */
name: string; 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 * The task's execution engine
*/ */

View file

@ -963,13 +963,6 @@ declare module 'vscode' {
} }
//#endregion //#endregion
/**
* A task to execute
*/
export class Task2 extends Task {
detail?: string;
}
//#region Task presentation group: https://github.com/microsoft/vscode/issues/47265 //#region Task presentation group: https://github.com/microsoft/vscode/issues/47265
export interface TaskPresentationOptions { export interface TaskPresentationOptions {
/** /**

View file

@ -1098,7 +1098,6 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
SymbolKind: extHostTypes.SymbolKind, SymbolKind: extHostTypes.SymbolKind,
SymbolTag: extHostTypes.SymbolTag, SymbolTag: extHostTypes.SymbolTag,
Task: extHostTypes.Task, Task: extHostTypes.Task,
Task2: extHostTypes.Task,
TaskGroup: extHostTypes.TaskGroup, TaskGroup: extHostTypes.TaskGroup,
TaskPanelKind: extHostTypes.TaskPanelKind, TaskPanelKind: extHostTypes.TaskPanelKind,
TaskRevealKind: extHostTypes.TaskRevealKind, TaskRevealKind: extHostTypes.TaskRevealKind,

View file

@ -269,8 +269,8 @@ export namespace TaskDTO {
presentationOptions: TaskPresentationOptionsDTO.from(value.presentationOptions), presentationOptions: TaskPresentationOptionsDTO.from(value.presentationOptions),
problemMatchers: value.problemMatchers, problemMatchers: value.problemMatchers,
hasDefinedMatchers: (value as types.Task).hasDefinedMatchers, hasDefinedMatchers: (value as types.Task).hasDefinedMatchers,
runOptions: (<vscode.Task>value).runOptions ? (<vscode.Task>value).runOptions : { reevaluateOnRerun: true }, runOptions: value.runOptions ? value.runOptions : { reevaluateOnRerun: true },
detail: (<vscode.Task2>value).detail detail: value.detail
}; };
return result; return result;
} }

View file

@ -1875,7 +1875,7 @@ export class CustomExecution implements vscode.CustomExecution {
} }
@es5ClassCompat @es5ClassCompat
export class Task implements vscode.Task2 { export class Task implements vscode.Task {
private static ExtensionCallbackType: string = 'customExecution'; private static ExtensionCallbackType: string = 'customExecution';
private static ProcessType: string = 'process'; private static ProcessType: string = 'process';

View file

@ -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. // 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 // 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. // 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));
} }
} }
} }