Trivia before comma in tuple
Issue created from fantomas-online
Code
let a = (1
#if TEST
, 2
#endif
)
Result
let a =
(1,
#if TEST
2
#endif
)
Problem description
Notice how the comma which was in the compiler preconditional gets lifted out of it.
Maybe such case should be formatted:
let a =
(1
#if TEST
, 2
#endif
)
Maybe a warning showing the location of the invalid construct, and formatting the remaining constructs would be good solution rather than failing to format the whole file?
Extra information
- [x] The formatted result breaks my code.
- [ ] The formatted result gives compiler warnings.
- [ ] I or my company would be willing to help fix this.
Options
Fantomas master branch at 2022-06-28T06:06:04Z - f175d437748ce81cf3b135d70e91d015e6d6be77
Default Fantomas configuration
Hello, thank you for reporting this issue.
You are using conditional directives in a very exotic location there. Perhaps if the commas inside a tuple are used as trivia anchors you might be able to solve this.
Are you interested in submitting a PR for this?
@nojaf, sorry I glitched the title due to adjusting my post the wrong way.
I may take a look at the issue eventually, the issue is not urgent for me, so you may leave it as up for grabs.