Fix double array indentation inside parens

This commit is contained in:
Eugen Wissner 2021-06-10 20:23:07 +02:00
parent e79ba9f0c8
commit e0549070a1
No known key found for this signature in database
GPG Key ID: A27FDC1E8EE902C0
7 changed files with 86 additions and 82 deletions

View File

@ -629,6 +629,10 @@ private:
}
else if (arrayInitializerStart && isMultilineAt(index - 1))
{
if (peekBack2Is(tok!"(")) {
indents.pop();
}
// Use the close bracket as the indent token to distinguish
// the array initialiazer from an array index in the newline
// handling code

View File

@ -1,7 +1,7 @@
unittest
{
foo([
target.value.region[1], target.value.region[1],
target.value.region[1], target.value.region[1], target.value.region[1]
target.value.region[1], target.value.region[1], target.value.region[1],
target.value.region[1], target.value.region[1]
]);
}

View File

@ -7,8 +7,8 @@ unittest
]),
"short": Bson(["a": "b", "c": "d"]),
"numbers": Bson([
1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0
1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2,
3, 4, 5, 6, 7, 8, 9, 0
]),
"shuffleOnReset": serializeToBson([
"all": false,

View File

@ -1,6 +1,6 @@
unittest {
foo([
target.value.region[1], target.value.region[1],
target.value.region[1], target.value.region[1], target.value.region[1]
target.value.region[1], target.value.region[1], target.value.region[1],
target.value.region[1], target.value.region[1]
]);
}

View File

@ -6,8 +6,8 @@ unittest {
]),
"short": Bson(["a": "b", "c": "d"]),
"numbers": Bson([
1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0
1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2,
3, 4, 5, 6, 7, 8, 9, 0
]),
"shuffleOnReset": serializeToBson([
"all": false,