Skip to content

Commit af1310a

Browse files
committed
Depends on for user tasks should work
Fixes microsoft#90286
1 parent 1f86149 commit af1310a

1 file changed

Lines changed: 15 additions & 7 deletions

File tree

src/vs/workbench/contrib/tasks/common/taskConfiguration.ts

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ import { IWorkspaceFolder, IWorkspace } from 'vs/platform/workspace/common/works
2222
import * as Tasks from './tasks';
2323
import { TaskDefinitionRegistry } from './taskDefinitionRegistry';
2424
import { ConfiguredInput } from 'vs/workbench/services/configurationResolver/common/configurationResolver';
25+
import { URI } from 'vs/base/common/uri';
26+
import { USER_TASKS_GROUP_KEY } from 'vs/workbench/contrib/tasks/common/taskService';
2527

2628

2729
export const enum ShellQuoting {
@@ -1231,9 +1233,15 @@ namespace GroupKind {
12311233
}
12321234

12331235
namespace TaskDependency {
1234-
export function from(this: void, external: string | TaskIdentifier, context: ParseContext): Tasks.TaskDependency | undefined {
1236+
export function from(this: void, external: string | TaskIdentifier, context: ParseContext, source: TaskConfigSource): Tasks.TaskDependency | undefined {
12351237
if (Types.isString(external)) {
1236-
return { uri: context.workspace && context.workspace.configuration ? context.workspace.configuration : context.workspaceFolder.uri, task: external };
1238+
let uri: URI | string;
1239+
if (source === TaskConfigSource.User) {
1240+
uri = USER_TASKS_GROUP_KEY;
1241+
} else {
1242+
uri = context.workspace && context.workspace.configuration ? context.workspace.configuration : context.workspaceFolder.uri;
1243+
}
1244+
return { uri, task: external };
12371245
} else if (TaskIdentifier.is(external)) {
12381246
return {
12391247
uri: context.workspace && context.workspace.configuration ? context.workspace.configuration : context.workspaceFolder.uri,
@@ -1267,7 +1275,7 @@ namespace ConfigurationProperties {
12671275
{ property: 'options' }
12681276
];
12691277

1270-
export function from(this: void, external: ConfigurationProperties & { [key: string]: any; }, context: ParseContext, includeCommandOptions: boolean, properties?: IJSONSchemaMap): Tasks.ConfigurationProperties | undefined {
1278+
export function from(this: void, external: ConfigurationProperties & { [key: string]: any; }, context: ParseContext, includeCommandOptions: boolean, source: TaskConfigSource, properties?: IJSONSchemaMap): Tasks.ConfigurationProperties | undefined {
12711279
if (!external) {
12721280
return undefined;
12731281
}
@@ -1311,14 +1319,14 @@ namespace ConfigurationProperties {
13111319
if (external.dependsOn !== undefined) {
13121320
if (Types.isArray(external.dependsOn)) {
13131321
result.dependsOn = external.dependsOn.reduce((dependencies: Tasks.TaskDependency[], item): Tasks.TaskDependency[] => {
1314-
const dependency = TaskDependency.from(item, context);
1322+
const dependency = TaskDependency.from(item, context, source);
13151323
if (dependency) {
13161324
dependencies.push(dependency);
13171325
}
13181326
return dependencies;
13191327
}, []);
13201328
} else {
1321-
const dependsOnValue = TaskDependency.from(external.dependsOn, context);
1329+
const dependsOnValue = TaskDependency.from(external.dependsOn, context, source);
13221330
result.dependsOn = dependsOnValue ? [dependsOnValue] : undefined;
13231331
}
13241332
}
@@ -1435,7 +1443,7 @@ namespace ConfiguringTask {
14351443
RunOptions.fromConfiguration(external.runOptions),
14361444
{}
14371445
);
1438-
let configuration = ConfigurationProperties.from(external, context, true, typeDeclaration.properties);
1446+
let configuration = ConfigurationProperties.from(external, context, true, source, typeDeclaration.properties);
14391447
if (configuration) {
14401448
result.configurationProperties = Objects.assign(result.configurationProperties, configuration);
14411449
if (result.configurationProperties.name) {
@@ -1512,7 +1520,7 @@ namespace CustomTask {
15121520
identifier: taskName,
15131521
}
15141522
);
1515-
let configuration = ConfigurationProperties.from(external, context, false);
1523+
let configuration = ConfigurationProperties.from(external, context, false, source);
15161524
if (configuration) {
15171525
result.configurationProperties = Objects.assign(result.configurationProperties, configuration);
15181526
}

0 commit comments

Comments
 (0)