Open
Description
Issue created from fantomas-online
Code
let test x =
match x with
| Value1 -> 1
// | Value2 -> 2
| Value3 -> 3
let test2 x =
match x with
| Value1 -> 1
| Value2 -> 2
// | Value3 -> 3
Result
let test x =
match x with
| Value1 -> 1
// | Value2 -> 2
| Value3 -> 3
let test2 x =
match x with
| Value1 -> 1
| Value2 -> 2
// | Value3 -> 3
Problem description
If you comment a match case the alignment fits with the rest of the cases, but if you comment the last match case the alignment will be at the start of the line. (Happens with both main and dallas)
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.
Options
Fantomas main branch at 2022-12-03T22:59:05Z - 47c6ac6
Default Fantomas configuration
Did you know that you can ignore files when formatting from fantomas-tool or the FAKE targets by using a .fantomasignore file?
Activity
nojaf commentedon Dec 9, 2022
Hi there, this is a known problem for Fantomas.
The tl;dr is that the comment is assigned to the parent node (the entire let binding) instead of the last child in front of it (the last clause). This is wrong, yet supremely hard to deal with.
There have been numerous reports of this problem, we are aware of it and perhaps I should make a general write up why this so hard to figure out.
I would be happy to collaborate on this problem if you are up for it.
Who knows, maybe we can set a step in the right direction.
Let me know if you are interested.