Skip to content

Commit

Permalink
Support tasks presentation received from plugins
Browse files Browse the repository at this point in the history
Support tasks presentation options received from plugins

This expands the functionality introduced in pull request #6814

The following presentation options are now available for use by
plugins:

presentationOptions.reveal
presentationOptions.focus
presentationOptions.echo
presentationOptions.showReuseMessage
presentationOptions.panel
presentationOptions.clear

Signed-off-by: Alvaro Sanchez-Leon <alvaro.sanchez-leon@ericsson.com>
  • Loading branch information
alvsan09 committed Mar 24, 2021
1 parent eb83e0e commit cb0d6e7
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 6 deletions.
9 changes: 9 additions & 0 deletions packages/plugin-ext/src/common/plugin-api-rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1319,10 +1319,19 @@ export interface TaskDto {
problemMatcher?: any;
group?: string;
detail?: string;
presentation?: TaskPresentationOptionsDTO;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
[key: string]: any;
}

export interface TaskPresentationOptionsDTO {
reveal?: number;
focus?: boolean;
echo?: boolean;
panel?: number;
showReuseMessage?: boolean;
}

export interface TaskExecutionDto {
id: number;
task: TaskDto;
Expand Down
3 changes: 3 additions & 0 deletions packages/plugin-ext/src/plugin/type-converters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -708,6 +708,9 @@ export function fromTask(task: theia.Task): TaskDto | undefined {
const taskDto = {} as TaskDto;
taskDto.label = task.name;
taskDto.source = task.source;

taskDto.presentation = task.presentationOptions;

if ((task as types.Task).hasProblemMatchers) {
taskDto.problemMatcher = task.problemMatchers;
}
Expand Down
1 change: 1 addition & 0 deletions packages/plugin-ext/src/plugin/types-impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1774,6 +1774,7 @@ export class Task {
this.hasTaskProblemMatchers = false;
}
this.isTaskBackground = false;
this.presentationOptions = Object.create(null);
}

get definition(): theia.TaskDefinition {
Expand Down
12 changes: 6 additions & 6 deletions packages/task/src/common/task-protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ export enum DependsOrder {
}

export enum RevealKind {
Always = 'always',
Silent = 'silent',
Never = 'never'
Always = 1,
Silent = 2,
Never = 3
}

export enum PanelKind {
Shared = 'shared',
Dedicated = 'dedicated',
New = 'new'
Shared = 1,
Dedicated = 2,
New = 3
}

export interface TaskOutputPresentation {
Expand Down

0 comments on commit cb0d6e7

Please sign in to comment.