-
-
Notifications
You must be signed in to change notification settings - Fork 200
Open
Labels
Description
Issue created from fantomas-online
Code
type X = int
and
#if NET5_0_OR_GREATER
[<System.Runtime.CompilerServices.IsReadOnly>]
#endif
[<CustomEquality; NoComparison; Struct>] Y = int
Error
System.FormatException: Fantomas is trying to format the input multiple times due to the detection of multiple defines.
There is a problem with merging all the code back together.
[] has 5 fragments
[NET5_0_OR_GREATER] has 3 fragments
Please raise an issue at https://fsprojects.github.io/fantomas-tools/#/fantomas/preview.
at Fantomas.Core.MultipleDefineCombinations.mergeMultipleFormatResults(FormatConfig config, FSharpList`1 results) in /_//src/Fantomas.Core/MultipleDefineCombinations.fs:line 211
at Fantomas.Core.CodeFormatterImpl.formatDocument@95-5.Invoke(FSharpList`1 results) in /_//src/Fantomas.Core/CodeFormatterImpl.fs:line 99
at Microsoft.FSharp.Control.AsyncPrimitives.CallThenInvokeNoHijackCheck[a,b](AsyncActivation`1 ctxt, b result1, FSharpFunc`2 userCode) in D:\a\_work\1\s\src\FSharp.Core\async.fs:line 528
at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc`2 firstAction) in D:\a\_work\1\s\src\FSharp.Core\async.fs:line 112
Problem description
See error: as far as I know this is perfectly reasonable code :)
This is a link to the original file where this was encountered
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 2025-07-04T12:03:12Z - fab1bd8
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.