I want function call parameters to wrap one per line if the call line gets longer than 120 characters.
For example:
foo(red, yellow + green, blue); // Assuming this breaks line length
Should become:
foo(
red,
yellow + green,
blue
);
So I used the following hxformat file:
{
"wrapping": {
"maxLineLength": 120,
"callParameter": {
"defaultWrap": "fillLine",
"rules": [
{
"conditions": [
{
"cond": "lineLength >= n",
"value": 120
}
],
"type": "onePerLine"
}
]
},
"functionSignature": {
"defaultWrap": "fillLine",
"rules": [
{
"conditions": [
{
"cond": "lineLength >= n",
"value": 120
}
],
"type": "onePerLine"
}
]
}
},
"whitespace": {
"colonPolicy": "after",
"typeHintColonPolicy": "after"
}
}
Which seems to work great, until I came across this file (here trimmed down for repro):
class MeshChunkTask extends Task {
public override function run(context: TaskContext) {
var meshingVoxelBuffer = meshingVoxelBufferPerThread[context.threadIndex];
meshingVoxelBuffer.fill(0);
var srcI = 0;
for (rcz in -1...2) {
for (rcy in -1...2) {
for (rcx in -1...2) {
var src = chunks[srcI];
srcI += 1;
if (src != null) {
meshingVoxelBuffer.paste(src.voxels,
rcx * Constants.CHUNK_SIZE
+ Mesher.PAD,
rcy * Constants.CHUNK_SIZE
+ Mesher.PAD,
rcz * Constants.CHUNK_SIZE
+ Mesher.PAD);
src.releaseShared();
}
}
}
}
outputPrim = Mesher.build(meshingVoxelBuffer);
outputList.push(this);
}
}
The call to paste( is not formatted the way I expected. I expected the first parameter to be on the next line, but it is on the first. Also, I expected the expression of each parameter to be on one line, but instead they are getting further broken up at the + operators. They don't even break line length on their own.
No matter how I rearrange this code (not changing what it does), it keeps formatting like above.
It still reproduces as this simple function:
function foo() {
meshingVoxelBuffer.paste(src.voxels,
rcx * Constants.CHUNK_SIZE
+ Mesher.PAD,
rcy * Constants.CHUNK_SIZE
+ Mesher.PAD,
rcz * Constants.CHUNK_SIZE
+ Mesher.PAD);
}
Now something curious, if I remove + Mesher.PAD from the last parameter, it suddenly formats as I expect:
meshingVoxelBuffer.paste(
src.voxels,
rcx * Constants.CHUNK_SIZE + Mesher.PAD,
rcy * Constants.CHUNK_SIZE + Mesher.PAD,
rcz * Constants.CHUNK_SIZE
);
But if I add it back... it breaks.
meshingVoxelBuffer.paste(src.voxels,
rcx * Constants.CHUNK_SIZE
+ Mesher.PAD,
rcy * Constants.CHUNK_SIZE
+ Mesher.PAD,
rcz * Constants.CHUNK_SIZE
+ Mesher.PAD);
I want function call parameters to wrap one per line if the call line gets longer than 120 characters.
For example:
Should become:
So I used the following hxformat file:
{ "wrapping": { "maxLineLength": 120, "callParameter": { "defaultWrap": "fillLine", "rules": [ { "conditions": [ { "cond": "lineLength >= n", "value": 120 } ], "type": "onePerLine" } ] }, "functionSignature": { "defaultWrap": "fillLine", "rules": [ { "conditions": [ { "cond": "lineLength >= n", "value": 120 } ], "type": "onePerLine" } ] } }, "whitespace": { "colonPolicy": "after", "typeHintColonPolicy": "after" } }Which seems to work great, until I came across this file (here trimmed down for repro):
The call to
paste(is not formatted the way I expected. I expected the first parameter to be on the next line, but it is on the first. Also, I expected the expression of each parameter to be on one line, but instead they are getting further broken up at the+operators. They don't even break line length on their own.No matter how I rearrange this code (not changing what it does), it keeps formatting like above.
It still reproduces as this simple function:
Now something curious, if I remove
+ Mesher.PADfrom the last parameter, it suddenly formats as I expect:But if I add it back... it breaks.