Skip to content

Commit 36bd747

Browse files
committed
Allow empty array for shell args in tasks
Fixes microsoft#53306
1 parent 2c063fa commit 36bd747

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ interface MetaData<T, U> {
552552
}
553553

554554

555-
function _isEmpty<T>(this: void, value: T | undefined, properties: MetaData<T, any>[] | undefined): boolean {
555+
function _isEmpty<T>(this: void, value: T | undefined, properties: MetaData<T, any>[] | undefined, allowEmptyArray: boolean = false): boolean {
556556
if (value === undefined || value === null || properties === undefined) {
557557
return true;
558558
}
@@ -561,7 +561,7 @@ function _isEmpty<T>(this: void, value: T | undefined, properties: MetaData<T, a
561561
if (property !== undefined && property !== null) {
562562
if (meta.type !== undefined && !meta.type.isEmpty(property)) {
563563
return false;
564-
} else if (!Array.isArray(property) || property.length > 0) {
564+
} else if (!Array.isArray(property) || (property.length > 0) || allowEmptyArray) {
565565
return false;
566566
}
567567
}
@@ -591,11 +591,11 @@ function _assignProperties<T>(this: void, target: T | undefined, source: T | und
591591
return target;
592592
}
593593

594-
function _fillProperties<T>(this: void, target: T | undefined, source: T | undefined, properties: MetaData<T, any>[] | undefined): T | undefined {
594+
function _fillProperties<T>(this: void, target: T | undefined, source: T | undefined, properties: MetaData<T, any>[] | undefined, allowEmptyArray: boolean = false): T | undefined {
595595
if (!source || _isEmpty(source, properties)) {
596596
return target;
597597
}
598-
if (!target || _isEmpty(target, properties)) {
598+
if (!target || _isEmpty(target, properties, allowEmptyArray)) {
599599
return source;
600600
}
601601
for (let meta of properties!) {
@@ -727,15 +727,15 @@ namespace ShellConfiguration {
727727
}
728728

729729
export function isEmpty(this: void, value: Tasks.ShellConfiguration): boolean {
730-
return _isEmpty(value, properties);
730+
return _isEmpty(value, properties, true);
731731
}
732732

733733
export function assignProperties(this: void, target: Tasks.ShellConfiguration | undefined, source: Tasks.ShellConfiguration | undefined): Tasks.ShellConfiguration | undefined {
734734
return _assignProperties(target, source, properties);
735735
}
736736

737737
export function fillProperties(this: void, target: Tasks.ShellConfiguration, source: Tasks.ShellConfiguration): Tasks.ShellConfiguration | undefined {
738-
return _fillProperties(target, source, properties);
738+
return _fillProperties(target, source, properties, true);
739739
}
740740

741741
export function fillDefaults(this: void, value: Tasks.ShellConfiguration, context: ParseContext): Tasks.ShellConfiguration {

0 commit comments

Comments
 (0)