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

@ -1,24 +1,24 @@
unittest
{
Bson base = Bson([
"maps": Bson([
Bson(["id": Bson(4), "comment": Bson("hello")]),
Bson(["id": Bson(49), "comment": Bson(null)])
]),
"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
]),
"shuffleOnReset": serializeToBson([
"all": false,
"selected": true,
"maybe": false
]),
"resetOnEmpty": Bson(false),
"applyMods": Bson(true),
"sendComments": Bson(true)
]);
"maps": Bson([
Bson(["id": Bson(4), "comment": Bson("hello")]),
Bson(["id": Bson(49), "comment": Bson(null)])
]),
"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
]),
"shuffleOnReset": serializeToBson([
"all": false,
"selected": true,
"maybe": false
]),
"resetOnEmpty": Bson(false),
"applyMods": Bson(true),
"sendComments": Bson(true)
]);
int[] x = [
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

View File

@ -1,25 +1,25 @@
auto find()
{
return Map.findRange([
"$and": [
["deleted": Bson(false)],
[
"$or": Bson([
serializeToBson(["forceUpdate": Bson(true)]),
serializeToBson([
"info.approved": ["$eq": Bson(1)],
"fetchDate": [
"$lte": Bson(BsonDate(currentTime - 60.days))
]
]),
serializeToBson([
"info.approved": ["$ne": Bson(1)],
"fetchDate": [
"$lte": Bson(BsonDate(currentTime - 14.days))
]
])
])
]
"$and": [
["deleted": Bson(false)],
[
"$or": Bson([
serializeToBson(["forceUpdate": Bson(true)]),
serializeToBson([
"info.approved": ["$eq": Bson(1)],
"fetchDate": [
"$lte": Bson(BsonDate(currentTime - 60.days))
]
]),
serializeToBson([
"info.approved": ["$ne": Bson(1)],
"fetchDate": [
"$lte": Bson(BsonDate(currentTime - 14.days))
]
])
])
]
]);
]
]);
}

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

@ -1,23 +1,23 @@
unittest {
Bson base = Bson([
"maps": Bson([
Bson(["id": Bson(4), "comment": Bson("hello")]),
Bson(["id": Bson(49), "comment": Bson(null)])
]),
"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
]),
"shuffleOnReset": serializeToBson([
"all": false,
"selected": true,
"maybe": false
]),
"resetOnEmpty": Bson(false),
"applyMods": Bson(true),
"sendComments": Bson(true)
]);
"maps": Bson([
Bson(["id": Bson(4), "comment": Bson("hello")]),
Bson(["id": Bson(49), "comment": Bson(null)])
]),
"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
]),
"shuffleOnReset": serializeToBson([
"all": false,
"selected": true,
"maybe": false
]),
"resetOnEmpty": Bson(false),
"applyMods": Bson(true),
"sendComments": Bson(true)
]);
int[] x = [
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

View File

@ -1,24 +1,24 @@
auto find() {
return Map.findRange([
"$and": [
["deleted": Bson(false)],
[
"$or": Bson([
serializeToBson(["forceUpdate": Bson(true)]),
serializeToBson([
"info.approved": ["$eq": Bson(1)],
"fetchDate": [
"$lte": Bson(BsonDate(currentTime - 60.days))
]
]),
serializeToBson([
"info.approved": ["$ne": Bson(1)],
"fetchDate": [
"$lte": Bson(BsonDate(currentTime - 14.days))
]
])
])
]
"$and": [
["deleted": Bson(false)],
[
"$or": Bson([
serializeToBson(["forceUpdate": Bson(true)]),
serializeToBson([
"info.approved": ["$eq": Bson(1)],
"fetchDate": [
"$lte": Bson(BsonDate(currentTime - 60.days))
]
]),
serializeToBson([
"info.approved": ["$ne": Bson(1)],
"fetchDate": [
"$lte": Bson(BsonDate(currentTime - 14.days))
]
])
])
]
]);
]
]);
}