You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
letfoo=if bar then
a <-1else// whatnotif baz then
quux <-3
Result
letfoo=if bar then
a <-1elseif// whatnot
baz
then
quux <-3
Problem description
The comment has been moved with respect to the if statement. Expected instead was:
letfoo=if bar then
a <-1else// whatnotif baz then
quux <-3
(or, in my own codebase with ExperimentalKeepIndentInBranch, I expected no change to the formatting).
Extra information
The formatted result breaks my code.
The formatted result gives compiler warnings.
I or my company would be willing to help fix this.
I would like a release if this problem is solved.
Options
Fantomas main branch at 2023-12-06T16:47:58Z - 0f8ee23
Default Fantomas configuration
Did you know that you can ignore files when formatting by using a .fantomasignore file? PS: It's unlikely that someone else will solve your specific issue, as it's something that you have a personal stake in.
The text was updated successfully, but these errors were encountered:
So, the style guide settled on formatting multiline conditions like:
// ✔️ OK, but better to refactor, see belowif
complexExpression a b && env.IsDevelopment()|| someFunctionToCall
aVeryLongParameterNameOne
aVeryLongParameterNameTwo
aVeryLongParameterNameThree
then
e1
else
e2
// ✔️The same applies to nested `elif` or `else if` expressionsif a then
b
elif
someLongFunctionCall
argumentOne
argumentTwo
argumentThree
argumentFour
then
c
elseif
someOtherLongFunctionCall
argumentOne
argumentTwo
argumentThree
argumentFour
then
d
// whatnot between the else and the if forces this behaviour.
It rings a bell that putting anything between the else if can very easily lead to invalid code, so I believe we deliberately moved the comment.
From a technical point of view, we view your entire if expression as one node, and not the parent if/else node where the else expression is a if/then expression.
Issue created from fantomas-online
Code
Result
Problem description
The comment has been moved with respect to the
if
statement. Expected instead was:(or, in my own codebase with ExperimentalKeepIndentInBranch, I expected no change to the formatting).
Extra information
Options
Fantomas main branch at 2023-12-06T16:47:58Z - 0f8ee23
Default Fantomas configuration
Did you know that you can ignore files when formatting by using a .fantomasignore file?
PS: It's unlikely that someone else will solve your specific issue, as it's something that you have a personal stake in.
The text was updated successfully, but these errors were encountered: