Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/vs/workbench/api/browser/mainThreadTask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ namespace TaskDTO {
return result;
}

export function to(task: ITaskDTO | undefined, workspace: IWorkspaceContextService, executeOnly: boolean, icon?: { id?: string; color?: string }): ContributedTask | undefined {
export function to(task: ITaskDTO | undefined, workspace: IWorkspaceContextService, executeOnly: boolean, icon?: { id?: string; color?: string }, hide?: boolean): ContributedTask | undefined {
if (!task || (typeof task.name !== 'string')) {
return undefined;
}
Expand Down Expand Up @@ -383,7 +383,8 @@ namespace TaskDTO {
isBackground: !!task.isBackground,
problemMatchers: task.problemMatchers.slice(),
detail: task.detail,
icon
icon,
hide
}
);
return result;
Expand Down Expand Up @@ -492,7 +493,7 @@ export class MainThreadTask implements MainThreadTaskShape {
dto.name = ((dto.name === undefined) ? '' : dto.name); // Using an empty name causes the name to default to the one given by the provider.
return Promise.resolve(this._proxy.$resolveTask(handle, dto)).then(resolvedTask => {
if (resolvedTask) {
return TaskDTO.to(resolvedTask, this._workspaceContextServer, true, task.configurationProperties.icon);
return TaskDTO.to(resolvedTask, this._workspaceContextServer, true, task.configurationProperties.icon, task.configurationProperties.hide);
}

return undefined;
Expand Down
1 change: 1 addition & 0 deletions src/vs/workbench/api/common/shared/tasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ export interface ITaskSourceDTO {
scope?: number | UriComponents;
color?: string;
icon?: string;
hide?: boolean;
Comment thread
meganrogge marked this conversation as resolved.
}

export interface ITaskHandleDTO {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1588,7 +1588,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
{
identifier: id,
dependsOn: extensionTasks.map((extensionTask) => { return { uri: extensionTask.getWorkspaceFolder()!.uri, task: extensionTask._id }; }),
name: id,
name: id
}
);
return { task, resolver };
Expand Down
15 changes: 10 additions & 5 deletions src/vs/workbench/contrib/tasks/browser/taskQuickPick.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import { TaskQuickPickEntryType } from 'vs/workbench/contrib/tasks/browser/abstr

export const QUICKOPEN_DETAIL_CONFIG = 'task.quickOpen.detail';
export const QUICKOPEN_SKIP_CONFIG = 'task.quickOpen.skip';

export function isWorkspaceFolder(folder: IWorkspace | IWorkspaceFolder): folder is IWorkspaceFolder {
return 'uri' in folder;
}
Expand Down Expand Up @@ -108,7 +107,9 @@ export class TaskQuickPick extends Disposable {
groupLabel: string, extraButtons: IQuickInputButton[] = []) {
entries.push({ type: 'separator', label: groupLabel });
tasks.forEach(task => {
entries.push(this._createTaskEntry(task, extraButtons));
if (!task.configurationProperties.hide) {
entries.push(this._createTaskEntry(task, extraButtons));
}
});
}

Expand Down Expand Up @@ -304,7 +305,7 @@ export class TaskQuickPick extends Disposable {
private async _doPickerSecondLevel(picker: IQuickPick<ITaskTwoLevelQuickPickEntry>, type: string) {
picker.busy = true;
if (type === SHOW_ALL) {
const items = (await this._taskService.tasks()).sort((a, b) => this._sorter.compare(a, b)).map(task => this._createTaskEntry(task));
const items = (await this._taskService.tasks()).filter(t => !t.configurationProperties.hide).sort((a, b) => this._sorter.compare(a, b)).map(task => this._createTaskEntry(task));
items.push(...TaskQuickPick.allSettingEntries(this._configurationService));
picker.items = items;
} else {
Expand Down Expand Up @@ -353,9 +354,13 @@ export class TaskQuickPick extends Disposable {

private async _getEntriesForProvider(type: string): Promise<QuickPickInput<ITaskTwoLevelQuickPickEntry>[]> {
const tasks = (await this._taskService.tasks({ type })).sort((a, b) => this._sorter.compare(a, b));
let taskQuickPickEntries: QuickPickInput<ITaskTwoLevelQuickPickEntry>[];
let taskQuickPickEntries: QuickPickInput<ITaskTwoLevelQuickPickEntry>[] = [];
if (tasks.length > 0) {
taskQuickPickEntries = tasks.map(task => this._createTaskEntry(task));
for (const task of tasks) {
if (!task.configurationProperties.hide) {
taskQuickPickEntries.push(this._createTaskEntry(task));
}
}
taskQuickPickEntries.push({
type: 'separator'
}, {
Expand Down
22 changes: 16 additions & 6 deletions src/vs/workbench/contrib/tasks/browser/terminalTaskSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -516,12 +516,7 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem {
for (const dependency of task.configurationProperties.dependsOn) {
const dependencyTask = await resolver.resolve(dependency.uri, dependency.task!);
if (dependencyTask) {
if (dependencyTask.configurationProperties.icon) {
dependencyTask.configurationProperties.icon.id ||= task.configurationProperties.icon?.id;
dependencyTask.configurationProperties.icon.color ||= task.configurationProperties.icon?.color;
} else {
dependencyTask.configurationProperties.icon = task.configurationProperties.icon;
}
this._adoptConfigurationForDependencyTask(dependencyTask, task);
const key = dependencyTask.getMapKey();
let promise = this._activeTasks[key] ? this._getDependencyPromise(this._activeTasks[key]) : undefined;
if (!promise) {
Expand Down Expand Up @@ -590,6 +585,21 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem {
});
}

private _adoptConfigurationForDependencyTask(dependencyTask: Task, task: Task): void {
if (dependencyTask.configurationProperties.icon) {
dependencyTask.configurationProperties.icon.id ||= task.configurationProperties.icon?.id;
dependencyTask.configurationProperties.icon.color ||= task.configurationProperties.icon?.color;
} else {
dependencyTask.configurationProperties.icon = task.configurationProperties.icon;
}

if (dependencyTask.configurationProperties.hide) {
dependencyTask.configurationProperties.hide ||= task.configurationProperties.hide;
} else {
dependencyTask.configurationProperties.hide = task.configurationProperties.hide;
}
}

private async _getDependencyPromise(task: IActiveTerminalData): Promise<ITaskSummary> {
if (!task.task.configurationProperties.isBackground) {
return task.promise;
Expand Down
9 changes: 9 additions & 0 deletions src/vs/workbench/contrib/tasks/common/jsonSchema_v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ const shellCommand: IJSONSchema = {
deprecationMessage: nls.localize('JsonSchema.tasks.isShellCommand.deprecated', 'The property isShellCommand is deprecated. Use the type property of the task and the shell property in the options instead. See also the 1.14 release notes.')
};


const hide: IJSONSchema = {
type: 'boolean',
description: nls.localize('JsonSchema.hide', 'Hide this task from the run task quick pick'),
default: true
};

const taskIdentifier: IJSONSchema = {
type: 'object',
additionalProperties: true,
Expand Down Expand Up @@ -407,6 +414,7 @@ const taskConfiguration: IJSONSchema = {
},
presentation: Objects.deepClone(presentation),
icon: Objects.deepClone(icon),
hide: Objects.deepClone(hide),
options: options,
problemMatcher: {
$ref: '#/definitions/problemMatcherType',
Expand Down Expand Up @@ -479,6 +487,7 @@ taskDescriptionProperties.command = Objects.deepClone(command);
taskDescriptionProperties.args = Objects.deepClone(args);
taskDescriptionProperties.isShellCommand = Objects.deepClone(shellCommand);
taskDescriptionProperties.dependsOn = dependsOn;
taskDescriptionProperties.hide = Objects.deepClone(hide);
taskDescriptionProperties.dependsOrder = dependsOrder;
taskDescriptionProperties.identifier = Objects.deepClone(identifier);
taskDescriptionProperties.type = Objects.deepClone(taskType);
Expand Down
17 changes: 12 additions & 5 deletions src/vs/workbench/contrib/tasks/common/taskConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,11 @@ export interface IConfigurationProperties {
* The icon's color in the terminal tabs list
*/
color?: string;

/**
* Do not show this task in the run task quickpick
*/
hide?: boolean;
}

export interface ICustomTask extends ICommandProperties, IConfigurationProperties {
Expand Down Expand Up @@ -1322,7 +1327,8 @@ namespace ConfigurationProperties {
{ property: 'presentation', type: CommandConfiguration.PresentationOptions },
{ property: 'problemMatchers' },
{ property: 'options' },
{ property: 'icon' }
{ property: 'icon' },
{ property: 'hide' }
];

export function from(this: void, external: IConfigurationProperties & { [key: string]: any }, context: IParseContext,
Expand Down Expand Up @@ -1350,7 +1356,7 @@ namespace ConfigurationProperties {
result.identifier = external.identifier;
}
result.icon = external.icon;

result.hide = external.hide;
if (external.isBackground !== undefined) {
result.isBackground = !!external.isBackground;
}
Expand Down Expand Up @@ -1483,7 +1489,7 @@ namespace ConfiguringTask {
type,
taskIdentifier,
RunOptions.fromConfiguration(external.runOptions),
{}
{ hide: external.hide }
);
const configuration = ConfigurationProperties.from(external, context, true, source, typeDeclaration.properties);
result.addTaskLoadMessages(configuration.errors);
Expand Down Expand Up @@ -1635,7 +1641,8 @@ namespace CustomTask {
{
name: configuredProps.configurationProperties.name || contributedTask.configurationProperties.name,
identifier: configuredProps.configurationProperties.identifier || contributedTask.configurationProperties.identifier,
icon: configuredProps.configurationProperties.icon
icon: configuredProps.configurationProperties.icon,
hide: configuredProps.configurationProperties.hide
},

);
Expand Down Expand Up @@ -2119,7 +2126,7 @@ class ConfigurationParser {
identifier: name,
group: Tasks.TaskGroup.Build,
isBackground: isBackground,
problemMatchers: matchers,
problemMatchers: matchers
}
);
const taskGroupKind = GroupKind.from(fileConfig.group);
Expand Down
11 changes: 11 additions & 0 deletions src/vs/workbench/contrib/tasks/common/tasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,11 @@ export interface IConfigurationProperties {
* The icon for this task in the terminal tabs list
*/
icon?: { id?: string; color?: string };

/**
* Do not show this task in the run task quickpick
*/
hide?: boolean;
}

export enum RunOnOptions {
Expand Down Expand Up @@ -914,6 +919,11 @@ export class ContributedTask extends CommonTask {
*/
icon: { id?: string; color?: string } | undefined;

/**
* Don't show the task in the run task quickpick
*/
hide?: boolean;

public constructor(id: string, source: IExtensionTaskSource, label: string, type: string | undefined, defines: KeyedTaskIdentifier,
command: ICommandConfiguration, hasDefinedMatchers: boolean, runOptions: IRunOptions,
configurationProperties: IConfigurationProperties) {
Expand All @@ -922,6 +932,7 @@ export class ContributedTask extends CommonTask {
this.hasDefinedMatchers = hasDefinedMatchers;
this.command = command;
this.icon = configurationProperties.icon;
this.hide = configurationProperties.hide;
}

public override clone(): ContributedTask {
Expand Down