Skip to content

Commit 1ae0a6e

Browse files
committed
Fix the matching of compound tasks with workspace-overriden tasks
Task names in compount tasks should start with the task type to make it possible to override the referenced tasks in the workspace. Closes eng/ide/ada_language_server#1646
1 parent 2282212 commit 1ae0a6e

File tree

1 file changed

+22
-9
lines changed

1 file changed

+22
-9
lines changed

Diff for: integration/vscode/ada/src/taskProviders.ts

+22-9
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,10 @@ export class SimpleTaskProvider implements vscode.TaskProvider {
477477
label: getBuildAndRunTaskPlainName(main),
478478
taskDef: {
479479
type: this.taskType,
480-
compound: [buildTask.label, runTask.label],
480+
compound: [
481+
getConventionalTaskLabel(buildTask),
482+
getConventionalTaskLabel(runTask),
483+
],
481484
},
482485
problemMatchers: [],
483486
};
@@ -516,7 +519,10 @@ export class SimpleTaskProvider implements vscode.TaskProvider {
516519
label: getBuildAndRunGNATemulatorTaskPlainName(main),
517520
taskDef: {
518521
type: this.taskType,
519-
compound: [buildTask.label, runGNATemulatorTask.label],
522+
compound: [
523+
getConventionalTaskLabel(buildTask),
524+
getConventionalTaskLabel(runGNATemulatorTask),
525+
],
520526
},
521527
problemMatchers: [],
522528
};
@@ -525,7 +531,10 @@ export class SimpleTaskProvider implements vscode.TaskProvider {
525531
label: getBuildAndRunGNATemulatorTaskPlainName(main, true),
526532
taskDef: {
527533
type: this.taskType,
528-
compound: [buildTask.label, runGNATemulatorTaskForDebug.label],
534+
compound: [
535+
getConventionalTaskLabel(buildTask),
536+
getConventionalTaskLabel(runGNATemulatorTaskForDebug),
537+
],
529538
},
530539
problemMatchers: [],
531540
};
@@ -1213,13 +1222,17 @@ export function isFromWorkspace(task: vscode.Task): boolean {
12131222
/**
12141223
*
12151224
* @param task - a task
1216-
* @returns the label typically generated for that task by vscode. For tasks not
1217-
* defined explicitly in the workspace, this is `ada: <task name>`. For tasks
1218-
* defined in the workspace simply return the name which should already include
1219-
* the convention.
1225+
* @returns the label typically generated for that task by vscode. For tasks
1226+
* not defined explicitly in the workspace, this is `<task type>: <task name>`.
1227+
* For tasks defined in the workspace simply return the name which should
1228+
* already include the convention.
12201229
*/
1221-
export function getConventionalTaskLabel(task: vscode.Task): string {
1222-
return isFromWorkspace(task) ? task.name : `${task.source}: ${task.name}`;
1230+
export function getConventionalTaskLabel(task: vscode.Task | PredefinedTask): string {
1231+
if (task instanceof vscode.Task) {
1232+
return isFromWorkspace(task) ? task.name : `${task.source}: ${task.name}`;
1233+
} else {
1234+
return `${task.taskDef.type}: ${task.label}`;
1235+
}
12231236
}
12241237

12251238
/**

0 commit comments

Comments
 (0)