Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comment is lost at the end of a match #1822

Closed
3 tasks
Smaug123 opened this issue Jul 10, 2021 · 1 comment · Fixed by #1832
Closed
3 tasks

Comment is lost at the end of a match #1822

Smaug123 opened this issue Jul 10, 2021 · 1 comment · Fixed by #1832

Comments

@Smaug123
Copy link
Contributor

Issue created from fantomas-online

Code

module Foo =

    let blah =
        it
        |> List.iter (fun (_, output) ->
            thing
            |> Map.iter (fun key value ->
                match value with
                | Ok (TestResult.Failure f) -> failwith ""
                | Error e -> failwith ""
                | _ -> () // hi!
            )
        )

Result

module Foo =

    let blah =
        it
        |> List.iter
            (fun (_, output) ->
                thing
                |> Map.iter
                    (fun key value ->
                        match value with
                        | Ok (TestResult.Failure f) -> failwith ""
                        | Error e -> failwith ""
                        | _ -> ()))

Problem description

Notice that the // hi! has vanished.

Extra information

  • The formatted result breaks by code.
  • The formatted result gives compiler warnings.
  • I or my company would be willing to help fix this.

Options

Fantomas Master at 07/07/2021 07:46:28 - 6f0df78

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?

@nojaf
Copy link
Contributor

nojaf commented Jul 13, 2021

This happens as well with fsharp_multi_line_lambda_closing_newline=true.

nojaf added a commit to nojaf/fantomas that referenced this issue Jul 18, 2021
knocte added a commit to nblockchain/fantomless that referenced this issue Sep 20, 2021
It is failing with:

Microsoft (R) Build Engine version 16.11.0+0538acc04 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

/Users/runner/.dotnet/sdk/5.0.400/MSBuild.dll -maxcpucount -property:Configuration=Release -property:PackageOutputPath=/Users/runner/work/fantomless/fantomless/bin /p:Title=Fantomas /p:PackageVersion=4.5.1 /p:Authors=Florian Verdonck Jindřich Ivánek /p:Owners=Anh-Dung Phan /p:PackageRequireLicenseAcceptance=false /p:Description=This library aims at formatting F# source files based on a given configuration.
Fantomas will ensure correct indentation and consistent spacing between elements in the source files.
Some common use cases include
(1) Reformatting a code base to conform a universal page width
(2) Converting legacy code from verbose syntax to light syntax
(3) Formatting auto-generated F# signatures. /p:Summary=Source code formatter for F# /p:PackageReleaseNotes=Fix StackOverflow exceptions when collecting ColMultilineItem list. [fsprojects#1839](fsprojects#1839)
Honor .fantomasignore file when processing a folder. [fsprojects#1834](fsprojects#1834)
Fix Overly indented members on a record type with accessibility modifier. [fsprojects#1824](fsprojects#1824)
Fix MultiLineLambdaClosingNewline not respected with function keyword. [fsprojects#1823](fsprojects#1823)
Fix Comment is lost at the end of a match. [fsprojects#1822](fsprojects#1822) /p:Copyright=Copyright © 2021 /p:PackageTags=F# fsharp formatting beautifier indentation indenter /p:PackageProjectUrl=https://github.com/fsprojects/fantomas -target:pack -verbosity:m /bl:/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/tmpF67x0C.tmp.binlog /clp:ForceConsoleColor src/Fantomas/Fantomas.fsproj
  Fantomas -> /Users/runner/work/fantomless/fantomless/src/Fantomas/bin/Release/netstandard2.0/Fantomas.dll
  Paket version 6.0.0-rc006
  Total time taken: 0 milliseconds
/Users/runner/work/fantomless/fantomless/.paket/Paket.Restore.targets(370,15): error MSB4030: " " is an invalid value for the "NoDefaultExcludes" parameter of the "PackTask" task. The "NoDefaultExcludes" parameter is of type "System.Boolean". [/Users/runner/work/fantomless/fantomless/src/Fantomas/Fantomas.fsproj]
: /Users/runner/work/fantomless/fantomless/.paket/Paket.Restore.targets(370,15): error MSB4030: " " is an invalid value for the "NoDefaultExcludes" parameter of the "PackTask" task. The "NoDefaultExcludes" parameter is of type "System.Boolean".
Finished (Failed) 'DotNet:pack' in 00:00:17.2484182
Finished (Failed) 'Pack' in 00:00:17.2537065

---------------------------------------------------------------------
Build Time Report
---------------------------------------------------------------------
Target           Duration
------           --------
Clean            00:00:00.0054029
ProjectVersion   00:00:00.0095845
CheckFormat      00:00:28.1530106
Build            00:00:50.1780681
UnitTests        00:00:52.8291326
Benchmark        00:01:18.1282908
Pack             00:00:17.2535228   (Exception of type 'Fake.DotNet.MSBuildException' was thrown.)
All              00:00:00           (skipped)
Total:           00:03:46.6883141
Status:          Failure
---------------------------------------------------------------------
Script reported an error:
-> BuildFailedException: Target 'Pack' failed.
-> One or more errors occurred. (Exception of type 'Fake.DotNet.MSBuildException' was thrown.)
-> MSBuildException: Exception of type 'Fake.DotNet.MSBuildException' was thrown.
Hint: To further diagnose the problem you can run fake in verbose mode `fake -v run ...` or set the 'FAKE_DETAILED_ERRORS' environment variable to 'true'
Hint: Could not find a version in your paket.dependencies file, consider adding 'version 5.257.0' at the top of your dependencies file (/Users/runner/work/fantomless/fantomless/paket.dependencies).
Read fsprojects/FAKE#2193 for details.
knocte added a commit to nblockchain/fantomless that referenced this issue Sep 20, 2021
More info: fsprojects/Paket#4069

It was giving this error:
Microsoft (R) Build Engine version 16.11.0+0538acc04 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

/Users/runner/.dotnet/sdk/5.0.400/MSBuild.dll -maxcpucount -property:Configuration=Release -property:PackageOutputPath=/Users/runner/work/fantomless/fantomless/bin /p:Title=Fantomas /p:PackageVersion=4.5.1 /p:Authors=Florian Verdonck Jindřich Ivánek /p:Owners=Anh-Dung Phan /p:PackageRequireLicenseAcceptance=false /p:Description=This library aims at formatting F# source files based on a given configuration.
Fantomas will ensure correct indentation and consistent spacing between elements in the source files.
Some common use cases include
(1) Reformatting a code base to conform a universal page width
(2) Converting legacy code from verbose syntax to light syntax
(3) Formatting auto-generated F# signatures. /p:Summary=Source code formatter for F# /p:PackageReleaseNotes=Fix StackOverflow exceptions when collecting ColMultilineItem list. [fsprojects#1839](fsprojects#1839)
Honor .fantomasignore file when processing a folder. [fsprojects#1834](fsprojects#1834)
Fix Overly indented members on a record type with accessibility modifier. [fsprojects#1824](fsprojects#1824)
Fix MultiLineLambdaClosingNewline not respected with function keyword. [fsprojects#1823](fsprojects#1823)
Fix Comment is lost at the end of a match. [fsprojects#1822](fsprojects#1822) /p:Copyright=Copyright © 2021 /p:PackageTags=F# fsharp formatting beautifier indentation indenter /p:PackageProjectUrl=https://github.com/fsprojects/fantomas -target:pack -verbosity:m /bl:/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/tmpZzrMRy.tmp.binlog /clp:ForceConsoleColor src/Fantomas/Fantomas.fsproj
  Fantomas -> /Users/runner/work/fantomless/fantomless/src/Fantomas/bin/Release/netstandard2.0/Fantomas.dll
  Paket version 6.0.0-rc006
  Total time taken: 0 milliseconds
/Users/runner/work/fantomless/fantomless/.paket/Paket.Restore.targets(370,15): error MSB4030: " " is an invalid value for the "NoDefaultExcludes" parameter of the "PackTask" task. The "NoDefaultExcludes" parameter is of type "System.Boolean". [/Users/runner/work/fantomless/fantomless/src/Fantomas/Fantomas.fsproj]
: /Users/runner/work/fantomless/fantomless/.paket/Paket.Restore.targets(370,15): error MSB4030: " " is an invalid value for the "NoDefaultExcludes" parameter of the "PackTask" task. The "NoDefaultExcludes" parameter is of type "System.Boolean".
Finished (Failed) 'DotNet:pack' in 00:00:16.4637972
Finished (Failed) 'Pack' in 00:00:16.4690846
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants