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
Fantomas was not able to produce the same code after reformatting the result:
Having a comment on the last line of an anonymous record leads to an extra empty line being added each time you format
This is a relatively common scenario, i.e. using a comment temporarily to disable a certain field
Workaround
Just don't do this in code.
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.
Breaks Husky integration with precommit hook, the last line "walks down" on each format
Options
Fantomas main branch at 2022-10-08T06:02:14Z - b0eea04
{ config with
MultilineBlockBracketsOnSameColumn =true
ExperimentalStroustrupStyle =true}
Related example
A minor bug happens when Stroustrup is off. Note the comment being outdented and the closing |} bracket one space too far. Not sure it's related, see example without Stroustrup
Without Stroustrup example, before formatting
let x = {|
Y = 42
Z = "string"
Foo = "Bar"
// test
|}
Without Stroustrup after formatting
let x =
{| Y = 42
Z = "string"
Foo = "Bar"
// test
|}
Did you know that you can ignore files when formatting from fantomas-tool or the FAKE targets by using a .fantomasignore file?YES 😃
The text was updated successfully, but these errors were encountered:
abelbraaksma
changed the title
Idempotency problem when having a comment in an anonymous record
Idempotency problem when having a comment in an anonymous record and Stroustrup formatting
Oct 8, 2022
Issue created from fantomas-online
Original code
Formatted code
Reformatted code
Problem description
Fantomas was not able to produce the same code after reformatting the result:
Workaround
Just don't do this in code.
Extra information
The formatted result breaks my code.The formatted result gives compiler warnings.Options
Fantomas main branch at 2022-10-08T06:02:14Z - b0eea04
Related example
A minor bug happens when
Stroustrup
is off. Note the comment being outdented and the closing|}
bracket one space too far. Not sure it's related, see example without StroustrupWithout Stroustrup example, before formatting
Without Stroustrup after formatting
Did you know that you can ignore files when formatting from fantomas-tool or the FAKE targets by using a .fantomasignore file? YES 😃
The text was updated successfully, but these errors were encountered: