Skip to content

Commit

Permalink
plugin: align Task.detail declaration
Browse files Browse the repository at this point in the history
The commit aligns the declaration for `Task.detail` which was moved in
vscode from the proposed `Task2` to `Task`. The change aligns this
behavior to produce the proper result in the compatibility report, while
keeping backwards compatibility for `Task2` (used by the builtin-npm
among other extensions).

Signed-off-by: vince-fugnitto <[email protected]>
  • Loading branch information
vince-fugnitto committed Mar 24, 2022
1 parent 4ade592 commit acd6f57
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
4 changes: 2 additions & 2 deletions packages/plugin-ext/src/plugin/type-converters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,7 @@ export function fromTask(task: theia.Task): TaskDto | undefined {
taskDto.problemMatcher = task.problemMatchers;
}
if ('detail' in task) {
taskDto.detail = (task as theia.Task2).detail;
taskDto.detail = task.detail;
}
if (typeof task.scope === 'object') {
taskDto.scope = task.scope.uri.toString();
Expand Down Expand Up @@ -797,7 +797,7 @@ export function toTask(taskDto: TaskDto): theia.Task {
result.name = label;
result.source = source;
if (detail) {
(result as theia.Task2).detail = detail;
result.detail = detail;
}
if (typeof scope === 'string') {
const uri = URI.parse(scope);
Expand Down
4 changes: 1 addition & 3 deletions packages/plugin-ext/src/plugin/types-impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2086,9 +2086,7 @@ export class Task {
}

@es5ClassCompat
export class Task2 extends Task {
detail?: string;
}
export class Task2 extends Task { }

@es5ClassCompat
export class DebugAdapterExecutable {
Expand Down
14 changes: 11 additions & 3 deletions packages/plugin/src/theia.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10460,6 +10460,13 @@ export module '@theia/plugin' {
*/
source?: string;

/**
* A human-readable string which is rendered less prominently on a separate line in places
* where the task's name is displayed. Supports rendering of {@link ThemeIcon theme icons}
* via the `$(<name>)`-syntax.
*/
detail?: string;

/**
* The task group this tasks belongs to. See TaskGroup
* for a predefined set of available groups.
Expand All @@ -10478,9 +10485,10 @@ export module '@theia/plugin' {
problemMatchers?: string[];
}

export class Task2 extends Task {
detail?: string;
}
/**
* Task2 is kept for compatibility reasons.
*/
export class Task2 extends Task { }

export interface TaskProvider<T extends Task = Task> {
/**
Expand Down

0 comments on commit acd6f57

Please sign in to comment.