diff --git a/package.json b/package.json index c458908e7b04e..5bbccc2b559d7 100644 --- a/package.json +++ b/package.json @@ -112,7 +112,7 @@ "vscode-builtin-markdown": "https://open-vsx.org/api/vscode/markdown/1.44.2/file/vscode.markdown-1.44.2.vsix", "vscode-builtin-markdown-language-features": "https://open-vsx.org/api/vscode/markdown-language-features/1.39.1/file/vscode.markdown-language-features-1.39.1.vsix", "vscode-builtin-merge-conflict": "https://open-vsx.org/api/vscode/merge-conflict/1.44.2/file/vscode.merge-conflict-1.44.2.vsix", - "vscode-builtin-npm": "https://open-vsx.org/api/vscode/npm/1.39.1/file/vscode.npm-1.39.1.vsix", + "vscode-builtin-npm": "https://open-vsx.org/api/vscode/npm/1.44.2/file/vscode.npm-1.44.2.vsix", "vscode-builtin-node-debug": "https://github.com/theia-ide/vscode-node-debug/releases/download/v1.35.3/node-debug-1.35.3.vsix", "vscode-builtin-node-debug2": "https://open-vsx.org/api/ms-vscode/node-debug2/1.33.0/file/ms-vscode.node-debug2-1.33.0.vsix", "vscode-builtin-objective-c": "https://open-vsx.org/api/vscode/objective-c/1.44.2/file/vscode.objective-c-1.44.2.vsix", diff --git a/packages/plugin-ext/src/common/plugin-api-rpc.ts b/packages/plugin-ext/src/common/plugin-api-rpc.ts index 43877af9ccf9d..d43ac418e7512 100644 --- a/packages/plugin-ext/src/common/plugin-api-rpc.ts +++ b/packages/plugin-ext/src/common/plugin-api-rpc.ts @@ -1167,6 +1167,7 @@ export interface TaskDto { label: string; source?: string; scope: string | number; + detail?: string; // eslint-disable-next-line @typescript-eslint/no-explicit-any [key: string]: any; } diff --git a/packages/plugin-ext/src/plugin/plugin-context.ts b/packages/plugin-ext/src/plugin/plugin-context.ts index 1a236e4d37b8f..0aede30c8172d 100644 --- a/packages/plugin-ext/src/plugin/plugin-context.ts +++ b/packages/plugin-ext/src/plugin/plugin-context.ts @@ -98,6 +98,7 @@ import { TaskRevealKind, TaskGroup, Task, + Task2, DebugAdapterExecutable, DebugAdapterServer, Breakpoint, @@ -863,6 +864,7 @@ export function createAPIFactory( TaskPanelKind, TaskGroup, Task, + Task2, DebugAdapterExecutable, DebugAdapterServer, Breakpoint, diff --git a/packages/plugin-ext/src/plugin/type-converters.ts b/packages/plugin-ext/src/plugin/type-converters.ts index 219311f442413..b28f380b53ffb 100644 --- a/packages/plugin-ext/src/plugin/type-converters.ts +++ b/packages/plugin-ext/src/plugin/type-converters.ts @@ -708,6 +708,9 @@ export function fromTask(task: theia.Task): TaskDto | undefined { const taskDto = {} as TaskDto; taskDto.label = task.name; taskDto.source = task.source; + if ('detail' in task) { + taskDto.detail = (task as theia.Task2).detail; + } if (typeof task.scope === 'object') { taskDto.scope = task.scope.uri.toString(); } else if (typeof task.scope === 'number') { @@ -748,10 +751,13 @@ export function toTask(taskDto: TaskDto): theia.Task { throw new Error('Task should be provided for converting'); } - const { type, label, source, scope, command, args, options, windows, ...properties } = taskDto; + const { type, label, source, scope, detail, command, args, options, windows, ...properties } = taskDto; const result = {} as theia.Task; result.name = label; result.source = source; + if (detail) { + (result as theia.Task2).detail = detail; + } if (typeof scope === 'string') { const uri = URI.parse(scope); result.scope = { diff --git a/packages/plugin-ext/src/plugin/types-impl.ts b/packages/plugin-ext/src/plugin/types-impl.ts index 044ed3785eddd..eedf4b144ba1a 100644 --- a/packages/plugin-ext/src/plugin/types-impl.ts +++ b/packages/plugin-ext/src/plugin/types-impl.ts @@ -1808,6 +1808,10 @@ export class Task { } } +export class Task2 extends Task { + detail?: string; +} + export class DebugAdapterExecutable { /** * The command or path of the debug adapter executable. diff --git a/packages/plugin/src/theia.d.ts b/packages/plugin/src/theia.d.ts index 31ba386f106de..f0a5a00d9cab9 100644 --- a/packages/plugin/src/theia.d.ts +++ b/packages/plugin/src/theia.d.ts @@ -8884,6 +8884,10 @@ declare module '@theia/plugin' { problemMatchers?: string[]; } + export class Task2 extends Task { + detail?: string; + } + export interface TaskProvider { /** * Provides tasks. diff --git a/packages/task/src/browser/quick-open-task.ts b/packages/task/src/browser/quick-open-task.ts index 086fa4bc9850b..3382c4eb54846 100644 --- a/packages/task/src/browser/quick-open-task.ts +++ b/packages/task/src/browser/quick-open-task.ts @@ -506,6 +506,10 @@ export class TaskRunQuickOpenItem extends QuickOpenGroupItem { } return true; } + + getDetail(): string | undefined { + return this.task.detail; + } } export class ConfigureBuildOrTestTaskQuickOpenItem extends TaskRunQuickOpenItem { @@ -775,6 +779,10 @@ export class RunningTaskQuickOpenItem extends QuickOpenItem { } return this.options.run(mode); } + + getDetail(): string | undefined { + return this.taskInfo.config.detail; + } } @injectable() diff --git a/packages/task/src/browser/task-schema-updater.ts b/packages/task/src/browser/task-schema-updater.ts index 3fc111b9408d3..b1e706ada4c68 100644 --- a/packages/task/src/browser/task-schema-updater.ts +++ b/packages/task/src/browser/task-schema-updater.ts @@ -178,6 +178,7 @@ export class TaskSchemaUpdater { customizedDetectedTask.properties!.presentation = presentation; customizedDetectedTask.properties!.options = commandOptionsSchema; customizedDetectedTask.properties!.group = group; + customizedDetectedTask.properties!.detail = detail; customizedDetectedTask.additionalProperties = true; customizedDetectedTasks.push(customizedDetectedTask); }); @@ -603,6 +604,11 @@ const presentation: IJSONSchema = { } }; +const detail: IJSONSchema = { + type: 'string', + description: 'An optional description of a task that shows in the Run Task quick pick as a detail.' +}; + const taskIdentifier: IJSONSchema = { type: 'object', additionalProperties: true, @@ -675,7 +681,8 @@ const processTaskConfigurationSchema: IJSONSchema = { }, group, problemMatcher, - presentation + presentation, + detail, }, additionalProperties: true }; diff --git a/packages/task/src/common/task-protocol.ts b/packages/task/src/common/task-protocol.ts index 1612beae55de4..1e8e4a15a17d2 100644 --- a/packages/task/src/common/task-protocol.ts +++ b/packages/task/src/common/task-protocol.ts @@ -116,6 +116,7 @@ export interface TaskCustomization { group?: 'build' | 'test' | 'none' | { kind: 'build' | 'test' | 'none', isDefault: true }; problemMatcher?: string | ProblemMatcherContribution | (string | ProblemMatcherContribution)[]; presentation?: TaskOutputPresentation; + detail?: string; /** Whether the task is a background task or not. */ isBackground?: boolean;