bug(fmt): unexpected line breaks when accessing struct fields
Component
Forge
Have you ensured that all of these are up to date?
- [x] Foundry
- [x] Foundryup
What version of Foundry are you on?
forge Version: 1.4.4-v1.4.4 Commit SHA: 05794498bf47257b144e2e2789a1d5bf8566be0e
What version of Foundryup are you on?
foundryup: 1.3.0
What command(s) is the bug in?
forge fmt
Operating System
None
Describe the bug
Minimal repro to illustrate the case
// SPDX-License-Identifier: UNLICENSED
contract A {
function a() external {
bytes32 guid = _lzSend({
_dstEid: dstEid,
_message: message,
_options: OptionsBuilder.newOptions().addExecutorLzReceiveOption({_gas: gasLimit, _value: 0}),
_fee: MessagingFee({nativeFee: msg.value, lzTokenFee: 0}),
_refundAddress: msg.sender
}).guid;
}
function b() external view returns (uint256) {
return _quote({
_dstEid: dstEid,
_message: message,
_options: OptionsBuilder.newOptions().addExecutorLzReceiveOption({_gas: gasLimit, _value: 0}),
_payInLzToken: false
}).nativeFee;
}
}
Gets formatted as
// SPDX-License-Identifier: UNLICENSED
contract A {
function a() external {
bytes32 guid =
_lzSend({
_dstEid: dstEid,
_message: message,
_options: OptionsBuilder.newOptions().addExecutorLzReceiveOption({_gas: gasLimit, _value: 0}),
_fee: MessagingFee({nativeFee: msg.value, lzTokenFee: 0}),
_refundAddress: msg.sender
})
.guid;
}
function b() external view returns (uint256) {
return _quote({
_dstEid: dstEid,
_message: message,
_options: OptionsBuilder.newOptions().addExecutorLzReceiveOption({_gas: gasLimit, _value: 0}),
_payInLzToken: false
})
.nativeFee;
}
}
.structField line breaks looks weird, and the extra line break in the case with variable assigning doesn't look right.
Using the following fmt config
[fmt]
line_length = 120
multiline_func_header = 'all'
number_underscore = 'thousands'
sort_imports = true
prefer_compact = 'none'
Confirmed to still happen in the latest nightly:
forge Version: 1.4.4-nightly Commit SHA: 118e12edb96c4593be5809e0161000dc29a26654
Gm @0xrusowsky. Seeing that v1.5.0-rc1 still has the same behaviour as above, what's the status of the current issue?
@ChiTimesChi sorry for the delay, I'll check and try to provide a fix for asap