diff --git a/src/vs/workbench/parts/tasks/node/taskConfiguration.ts b/src/vs/workbench/parts/tasks/node/taskConfiguration.ts index 4cbe7cc1bf3f70afad449667ff7c12cc34924cc9..892c9a86003544f878884310e620a428b24ee3c9 100644 --- a/src/vs/workbench/parts/tasks/node/taskConfiguration.ts +++ b/src/vs/workbench/parts/tasks/node/taskConfiguration.ts @@ -858,7 +858,7 @@ namespace CommandConfiguration { osConfig = fromBase(config.linux, context); } if (osConfig) { - result = assignProperties(result, osConfig); + result = assignProperties(result, osConfig, context.schemaVersion === Tasks.JsonSchemaVersion.V2_0_0); } return isEmpty(result) ? undefined : result; } @@ -929,7 +929,7 @@ namespace CommandConfiguration { return _isEmpty(value, properties); } - export function assignProperties(target: Tasks.CommandConfiguration, source: Tasks.CommandConfiguration): Tasks.CommandConfiguration { + export function assignProperties(target: Tasks.CommandConfiguration, source: Tasks.CommandConfiguration, overwriteArgs: boolean): Tasks.CommandConfiguration { if (isEmpty(source)) { return target; } @@ -941,7 +941,7 @@ namespace CommandConfiguration { assignProperty(target, source, 'taskSelector'); assignProperty(target, source, 'suppressTaskName'); if (source.args !== void 0) { - if (target.args === void 0) { + if (target.args === void 0 || overwriteArgs) { target.args = source.args; } else { target.args = target.args.concat(source.args); diff --git a/src/vs/workbench/parts/tasks/test/electron-browser/configuration.test.ts b/src/vs/workbench/parts/tasks/test/electron-browser/configuration.test.ts index 8100e22fb6083af7258b37fb046b85a7430b0e95..88d2b03f9ef793faf36ec6e7c2a3026fb2b0c160 100644 --- a/src/vs/workbench/parts/tasks/test/electron-browser/configuration.test.ts +++ b/src/vs/workbench/parts/tasks/test/electron-browser/configuration.test.ts @@ -1585,6 +1585,56 @@ suite('Tasks version 2.0.0', () => { presentation().echo(true); testConfiguration(external, builder); }); + test('Arg overwrite', () => { + let external: ExternalTaskRunnerConfiguration = { + version: '2.0.0', + tasks: [ + { + label: 'echo', + type: 'shell', + command: 'echo', + args: [ + 'global' + ], + windows: { + args: [ + 'windows' + ] + }, + linux: { + args: [ + 'linux' + ] + }, + osx: { + args: [ + 'osx' + ] + } + } + ] + }; + let builder = new ConfiguationBuilder(); + if (Platform.isWindows) { + builder.task('echo', 'echo'). + command().suppressTaskName(true).args(['windows']). + runtime(Tasks.RuntimeType.Shell). + presentation().echo(true); + testConfiguration(external, builder); + } else if (Platform.isLinux) { + builder.task('echo', 'echo'). + command().suppressTaskName(true).args(['linux']). + runtime(Tasks.RuntimeType.Shell). + presentation().echo(true); + testConfiguration(external, builder); + } else if (Platform.isMacintosh) { + builder.task('echo', 'echo'). + command().suppressTaskName(true).args(['osx']). + runtime(Tasks.RuntimeType.Shell). + presentation().echo(true); + testConfiguration(external, builder); + } + }); }); suite('Bugs / regression tests', () => {