fsprojects / fantomas-tools

Collection of tools used when developing for Fantomas
https://fsprojects.github.io/fantomas-tools/
MIT License
34 stars 8 forks source link

There is a problem with merging all the code back together. #560

Closed minewarriorsSchool closed 1 year ago

minewarriorsSchool commented 1 year ago

While using the dotnet format rule from safestack command, fantomas give the following cmd error:

run Format
Building project with version: LocalBuild
Shortened DependencyGraph for Target Format:
<== Format

The running order is:
Group - 1
  - Format
Starting target 'Format'
src> "dotnet" fantomas . -r (In: false, Out: false, Err: false)
Processing .\Client\App.fs
'.\Client\App.fs' was unchanged
Processing .\Client\Index.fs
.\Client\Index.fs has been written.
Processing .\Server\AdminPassword.fs
'.\Server\AdminPassword.fs' was unchanged
Processing .\Server\Server.fs
'.\Server\Server.fs' was unchanged
Processing .\Server\WMI-MacId.fs
.\Server\WMI-MacId.fs has been written.
Processing .\Server\Wmi.fs
'.\Server\Wmi.fs' was unchanged
Processing .\Shared\Shared.fs
'.\Shared\Shared.fs' was unchanged
Processing .\Client\output\fable_modules\Fable.Elmish.3.1.0\cmd.fs
.\Client\output\fable_modules\Fable.Elmish.3.1.0\cmd.fs has been written.
Processing .\Client\output\fable_modules\Fable.Elmish.3.1.0\prelude.fs
.\Client\output\fable_modules\Fable.Elmish.3.1.0\prelude.fs has been written.
Processing .\Client\output\fable_modules\Fable.Elmish.3.1.0\program.fs
.\Client\output\fable_modules\Fable.Elmish.3.1.0\program.fs has been written.
Processing .\Client\output\fable_modules\Fable.Elmish.3.1.0\ring.fs
.\Client\output\fable_modules\Fable.Elmish.3.1.0\ring.fs has been written.
Processing .\Client\output\fable_modules\Fable.Elmish.Browser.3.0.4\navigation.fs
.\Client\output\fable_modules\Fable.Elmish.Browser.3.0.4\navigation.fs has been written.
Processing .\Client\output\fable_modules\Fable.Elmish.Browser.3.0.4\parser.fs
.\Client\output\fable_modules\Fable.Elmish.Browser.3.0.4\parser.fs has been written.
Processing .\Client\output\fable_modules\Fable.Elmish.Browser.3.0.4\prelude.fs
.\Client\output\fable_modules\Fable.Elmish.Browser.3.0.4\prelude.fs has been written.
Processing .\Client\output\fable_modules\Fable.Elmish.Debugger.3.3.0\debugger.fs
.\Client\output\fable_modules\Fable.Elmish.Debugger.3.3.0\debugger.fs has been written.
Processing .\Client\output\fable_modules\Fable.Elmish.Debugger.3.3.0\Fable.Import.RemoteDev.fs
.\Client\output\fable_modules\Fable.Elmish.Debugger.3.3.0\Fable.Import.RemoteDev.fs has been written.
Processing .\Client\output\fable_modules\Fable.Elmish.HMR.5.2.0\Bundler.fs
.\Client\output\fable_modules\Fable.Elmish.HMR.5.2.0\Bundler.fs has been written.
Processing .\Client\output\fable_modules\Fable.Elmish.HMR.5.2.0\common.fs
.\Client\output\fable_modules\Fable.Elmish.HMR.5.2.0\common.fs has been written.
Processing .\Client\output\fable_modules\Fable.Elmish.HMR.5.2.0\hmr.fs
.\Client\output\fable_modules\Fable.Elmish.HMR.5.2.0\hmr.fs has been written.
Processing .\Client\output\fable_modules\Fable.Elmish.HMR.5.2.0\HMR.Parcel.fs
.\Client\output\fable_modules\Fable.Elmish.HMR.5.2.0\HMR.Parcel.fs has been written.
Processing .\Client\output\fable_modules\Fable.Elmish.HMR.5.2.0\HMR.Vite.fs
.\Client\output\fable_modules\Fable.Elmish.HMR.5.2.0\HMR.Vite.fs has been written.
Processing .\Client\output\fable_modules\Fable.Elmish.HMR.5.2.0\HMR.Webpack.fs
.\Client\output\fable_modules\Fable.Elmish.HMR.5.2.0\HMR.Webpack.fs has been written.
Processing .\Client\output\fable_modules\Fable.Elmish.React.3.0.1\common.fs
.\Client\output\fable_modules\Fable.Elmish.React.3.0.1\common.fs has been written.
Processing .\Client\output\fable_modules\Fable.Elmish.React.3.0.1\react-native.fs
.\Client\output\fable_modules\Fable.Elmish.React.3.0.1\react-native.fs has been written.
Processing .\Client\output\fable_modules\Fable.Elmish.React.3.0.1\react.fs
.\Client\output\fable_modules\Fable.Elmish.React.3.0.1\react.fs has been written.
Processing .\Client\output\fable_modules\Fable.Parsimmon.4.1.0\Parsimmon.fs
.\Client\output\fable_modules\Fable.Parsimmon.4.1.0\Parsimmon.fs has been written.
Processing .\Client\output\fable_modules\Fable.React.7.4.3\Fable.React.Extensions.fs
.\Client\output\fable_modules\Fable.React.7.4.3\Fable.React.Extensions.fs has been written.
Processing .\Client\output\fable_modules\Fable.React.7.4.3\Fable.React.fs
.\Client\output\fable_modules\Fable.React.7.4.3\Fable.React.fs has been written.
Processing .\Client\output\fable_modules\Fable.React.7.4.3\Fable.React.FunctionComponent.fs
The following exception occurs while formatting stdin: System.Exception: Fantomas is trying to format the input multiple times due to the detect of multiple defines.
There is a problem with merging all the code back together.
[] has 17 fragments
[DEBUG, FABLE_COMPILER] has 16 fragments
[DEBUG, FABLE_COMPILER, FABLE_REPL_LIB] has 16 fragments
[FABLE_COMPILER] has 16 fragments
[DEBUG] has 17 fragments
[FABLE_REPL_LIB] has 17 fragments
Please raise an issue at https://fsprojects.github.io/fantomas-tools/#/fantomas/preview.
   at Microsoft.FSharp.Core.PrintfModule.PrintFormatToStringThenFail@1439.Invoke(String message) in D:\a\_work\1\s\src\fsharp\FSharp.Core\printf.fs:line 1439
   at Fantomas.CodeFormatterImpl.format@372-5.Invoke(FSharpList`1 results) in C:\Users\nojaf\Projects\fantomas\src\Fantomas\CodeFormatterImpl.fs:line 398
   at Microsoft.FSharp.Control.AsyncPrimitives.CallThenInvokeNoHijackCheck[a,b](AsyncActivation`1 ctxt, b result1, FSharpFunc`2 userCode) in D:\a\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 465
   at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc`2 firstAction) in D:\a\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 105
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.FSharp.Control.AsyncResult`1.Commit() in D:\a\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 392
   at Microsoft.FSharp.Control.AsyncPrimitives.QueueAsyncAndWaitForResultSynchronously[a](CancellationToken token, FSharpAsync`1 computation, FSharpOption`1 timeout) in D:\a\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 1044
   at Microsoft.FSharp.Control.AsyncPrimitives.RunSynchronously[T](CancellationToken cancellationToken, FSharpAsync`1 computation, FSharpOption`1 timeout) in D:\a\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 1070
   at Microsoft.FSharp.Control.FSharpAsync.RunSynchronously[T](FSharpAsync`1 computation, FSharpOption`1 timeout, FSharpOption`1 cancellationToken) in D:\a\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 1365
   at Program.processSourceString(Boolean isFsiFile, String s, FSharpChoice`2 tw, FormatConfig config) in C:\Users\nojaf\Projects\fantomas\src\Fantomas.CoreGlobalTool\Program.fs:line 129
   at Program.stringToFile@343(Boolean force, Boolean profile, String s, String outFile, FormatConfig config) in C:\Users\nojaf\Projects\fantomas\src\Fantomas.CoreGlobalTool\Program.fs:line 355
Fantomas is trying to format the input multiple times due to the detect of multiple defines.
There is a problem with merging all the code back together.
[] has 17 fragments
[DEBUG, FABLE_COMPILER] has 16 fragments
[DEBUG, FABLE_COMPILER, FABLE_REPL_LIB] has 16 fragments
[FABLE_COMPILER] has 16 fragments
[DEBUG] has 17 fragments
[FABLE_REPL_LIB] has 17 fragments
Please raise an issue at https://fsprojects.github.io/fantomas-tools/#/fantomas/preview.
Finished (Failed) 'Format' in 00:00:03.3097951
dawedawe commented 1 year ago

As we added fable_modules to the list of always ignored directories back in version 4.7.9, I suspect you're using a very old version that came with some safestack template. So, besides updating your Fantomas version, adding fable_modules to your .fantomasignore file might be a good idea.

Our upgrade guide is here, watch out for the name change.

I'll close this issue, as this repo is not the right one. If you still see bugs after following the advice given, please open issues over at Fantomas