Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support input variables for tasks #6331

Merged
merged 1 commit into from
Oct 6, 2019
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
4 changes: 3 additions & 1 deletion packages/task/src/browser/process/process-task-resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ export class ProcessTaskResolver implements TaskResolver {
throw new Error('Unsupported task configuration type.');
}
const context = new URI(this.taskDefinitionRegistry.getDefinition(taskConfig) ? taskConfig.scope : taskConfig._source).withScheme('file');
const variableResolverOptions = { context };
const variableResolverOptions = {
context, configurationSection: 'tasks'
};
const processTaskConfig = taskConfig as ProcessTaskConfiguration;
const result: ProcessTaskConfiguration = {
...processTaskConfig,
Expand Down
5 changes: 4 additions & 1 deletion packages/task/src/browser/task-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,10 @@ export class TaskService implements TaskConfigurationClient {
if (resolvedMatcher) {
const scope = task._scope || task._source;
if (resolvedMatcher.filePrefix && scope) {
const options = { context: new URI(scope).withScheme('file') };
const options = {
context: new URI(scope).withScheme('file'),
configurationSection: 'tasks'
};
const resolvedPrefix = await this.variableResolverService.resolve(resolvedMatcher.filePrefix, options);
Object.assign(resolvedMatcher, { filePrefix: resolvedPrefix });
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export class CommonVariableContribution implements VariableContribution {
const inputs = !!configuration && 'inputs' in configuration ? configuration.inputs : undefined;
const input = Array.isArray(inputs) && inputs.find(item => !!item && item.id === variable);
if (!input) {
return undefined;
throw new Error(`Undefined input variable "${variable}" encountered. Remove or define "${variable}" to continue.`);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@elaihau please revert all changes to resolver

I see what you want now, but we should do it holistically and fix in all other places. Please file an issue for it

}
if (input.type === 'promptString') {
if (typeof input.description !== 'string') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ export namespace VariableResolverService {
} catch (e) {
console.error(`Failed to resolved '${name}' variable`, e);
this.resolved.set(name, undefined);
throw e;
Copy link
Member

@akosyakov akosyakov Oct 6, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@elaihau could you elaborate why? It is a breaking change, before broken variables will computed as undefined, but the entire operation won't be stopped.

It affects not only tasks but also launch configurations. We should test this changes agains the debug extension before merging this PR.

}
}

Expand Down