Skip to content

Commit

Permalink
task part of #211878 (#211973)
Browse files Browse the repository at this point in the history
  • Loading branch information
meganrogge committed May 7, 2024
1 parent 40156c5 commit 8b86b2f
Showing 1 changed file with 11 additions and 16 deletions.
27 changes: 11 additions & 16 deletions src/vs/workbench/contrib/tasks/common/taskConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1003,8 +1003,7 @@ namespace CommandConfiguration {
runtime = Tasks.RuntimeType.fromString(config.type);
}
}
const isShellConfiguration = ShellConfiguration.is(config.isShellCommand);
if (Types.isBoolean(config.isShellCommand) || isShellConfiguration) {
if (Types.isBoolean(config.isShellCommand) || ShellConfiguration.is(config.isShellCommand)) {
runtime = Tasks.RuntimeType.Shell;
} else if (config.isShellCommand !== undefined) {
runtime = !!config.isShellCommand ? Tasks.RuntimeType.Shell : Tasks.RuntimeType.Process;
Expand Down Expand Up @@ -1034,8 +1033,8 @@ namespace CommandConfiguration {
}
if (config.options !== undefined) {
result.options = CommandOptions.from(config.options, context);
if (result.options && result.options.shell === undefined && isShellConfiguration) {
result.options.shell = ShellConfiguration.from(config.isShellCommand as IShellConfiguration, context);
if (result.options && result.options.shell === undefined && ShellConfiguration.is(config.isShellCommand)) {
result.options.shell = ShellConfiguration.from(config.isShellCommand, context);
if (context.engine !== Tasks.ExecutionEngine.Terminal) {
context.taskLoadIssues.push(nls.localize('ConfigurationParser.noShell', 'Warning: shell configuration is only supported when executing tasks in the terminal.'));
}
Expand Down Expand Up @@ -1247,11 +1246,6 @@ export namespace ProblemMatcherConverter {
}
}

const partialSource: Partial<Tasks.TaskSource> = {
label: 'Workspace',
config: undefined
};

export namespace GroupKind {
export function from(this: void, external: string | IGroupKind | undefined): Tasks.TaskGroup | undefined {
if (external === undefined) {
Expand Down Expand Up @@ -1399,6 +1393,7 @@ namespace ConfigurationProperties {
return _isEmpty(value, properties);
}
}
const label = 'Workspace';

namespace ConfiguringTask {

Expand Down Expand Up @@ -1470,15 +1465,15 @@ namespace ConfiguringTask {
let taskSource: Tasks.FileBasedTaskSource;
switch (source) {
case TaskConfigSource.User: {
taskSource = Object.assign({} as Tasks.IUserTaskSource, partialSource, { kind: Tasks.TaskSourceKind.User, config: configElement });
taskSource = { kind: Tasks.TaskSourceKind.User, config: configElement, label };
break;
}
case TaskConfigSource.WorkspaceFile: {
taskSource = Object.assign({} as Tasks.WorkspaceFileTaskSource, partialSource, { kind: Tasks.TaskSourceKind.WorkspaceFile, config: configElement });
taskSource = { kind: Tasks.TaskSourceKind.WorkspaceFile, config: configElement, label };
break;
}
default: {
taskSource = Object.assign({} as Tasks.IWorkspaceTaskSource, partialSource, { kind: Tasks.TaskSourceKind.Workspace, config: configElement });
taskSource = { kind: Tasks.TaskSourceKind.Workspace, config: configElement, label };
break;
}
}
Expand Down Expand Up @@ -1543,15 +1538,15 @@ namespace CustomTask {
let taskSource: Tasks.FileBasedTaskSource;
switch (source) {
case TaskConfigSource.User: {
taskSource = Object.assign({} as Tasks.IUserTaskSource, partialSource, { kind: Tasks.TaskSourceKind.User, config: { index, element: external, file: '.vscode/tasks.json', workspaceFolder: context.workspaceFolder } });
taskSource = { kind: Tasks.TaskSourceKind.User, config: { index, element: external, file: '.vscode/tasks.json', workspaceFolder: context.workspaceFolder }, label };
break;
}
case TaskConfigSource.WorkspaceFile: {
taskSource = Object.assign({} as Tasks.WorkspaceFileTaskSource, partialSource, { kind: Tasks.TaskSourceKind.WorkspaceFile, config: { index, element: external, file: '.vscode/tasks.json', workspaceFolder: context.workspaceFolder, workspace: context.workspace } });
taskSource = { kind: Tasks.TaskSourceKind.WorkspaceFile, config: { index, element: external, file: '.vscode/tasks.json', workspaceFolder: context.workspaceFolder, workspace: context.workspace }, label };
break;
}
default: {
taskSource = Object.assign({} as Tasks.IWorkspaceTaskSource, partialSource, { kind: Tasks.TaskSourceKind.Workspace, config: { index, element: external, file: '.vscode/tasks.json', workspaceFolder: context.workspaceFolder } });
taskSource = { kind: Tasks.TaskSourceKind.Workspace, config: { index, element: external, file: '.vscode/tasks.json', workspaceFolder: context.workspaceFolder }, label };
break;
}
}
Expand Down Expand Up @@ -2110,7 +2105,7 @@ class ConfigurationParser {
const name = Tasks.CommandString.value(globals.command.name);
const task: Tasks.CustomTask = new Tasks.CustomTask(
context.uuidMap.getUUID(name),
Object.assign({} as Tasks.IWorkspaceTaskSource, source, { config: { index: -1, element: fileConfig, workspaceFolder: context.workspaceFolder } }),
Object.assign({}, source, 'workspace', { config: { index: -1, element: fileConfig, workspaceFolder: context.workspaceFolder } }) satisfies Tasks.IWorkspaceTaskSource,
name,
Tasks.CUSTOMIZED_TASK_TYPE,
{
Expand Down

0 comments on commit 8b86b2f

Please sign in to comment.