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
| ConditionalDirectiveTrivia.Else r ->{ Item = Directive "#else"; Range = r }
| ConditionalDirectiveTrivia.EndIf r ->{ Item = Directive "#endif"; Range = r })
The range of EndIf does appear to be spanning till the end of the line.
So text could be reused in this case to restore the code comment.
I haven't tested this, but it sure looks that way.
Calling TrimEnd() after source.GetContentAt probably makes sense as well.
Issue created from fantomas-online
Code
Result
Problem description
#else
and#endif
are restored in a hardcoded fashion infantomas/src/Fantomas.Core/Trivia.fs
Lines 259 to 270 in deffd73
The range of
EndIf
does appear to be spanning till the end of the line.So
text
could be reused in this case to restore the code comment.I haven't tested this, but it sure looks that way.
Calling
TrimEnd()
aftersource.GetContentAt
probably makes sense as well.A unit test can be added to https://github.com/fsprojects/fantomas/blob/master/src/Fantomas.Core.Tests/CompilerDirectivesTests.fs.
//cc @dsyme
Extra information
Options
Fantomas master branch at 2022-06-07T15:04:36Z - deffd73
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?
The text was updated successfully, but these errors were encountered: