forked from FuelLabs/sway
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
formatter: fix handling of statements ending with
;
in if else
bl…
…ocks (FuelLabs#3557) unblocks FuelLabs#3556 closes FuelLabs#3555 ~The situation occurring in the issue seems to happen when the formatter tries to (incorrectly) assume that an if expression can be in-lined when there's a newline character inside. During this check, the line kind (multi-line vs inline) is decided solely depending on the width of the line, ignoring the existence of a `\n` character.~ ~This PR introduces something like a 'catch-all' during the above check to default to `LineKind::Multiline` if a `\n` is found during the look-ahead formatting done by the temporary formatter, which forces the formatter to use multi-line style, so that at the very least we don't end up with a broken inline format as seen in the issue.~ ~This catch-all might unblock the comment formatting PR above as well.~ The above was my misunderstanding - the mistake was further upstream instead within statement formatting. The inline style was not being handled for let statements.
- Loading branch information
1 parent
4264e2f
commit dc60866
Showing
3 changed files
with
88 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters