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

Shorter MaxLineLength with long variable name yields invalid F# code according to fantomas #1241

Closed
2 tasks
knocte opened this issue Nov 11, 2020 · 10 comments · Fixed by #1380
Closed
2 tasks

Comments

@knocte
Copy link
Contributor

knocte commented Nov 11, 2020

Issue created from fantomas-online

Code

namespace SomeNamespace

module SomeModule =

    let SomeFunc () =
        let someLocalFunc someVeryLooooooooooooooooooooooooooooooooooooooooooooooooongParam =
            async {
                if (someVeryLooooooooooooooooooooooooooooooooooooooooooooooooongParam = 1) then
                    return failwith "xxx"
            }
        ()

Error

Fantomas was able to format the code but the result appears to be invalid F# code.
Please open an issue.

Formatted result:

namespace SomeNamespace

module SomeModule =

    let SomeFunc () =
        let someLocalFunc someVeryLooooooooooooooooooooooooooooooooooooooooooooooooongParam =
            async {
                if (someVeryLooooooooooooooooooooooooooooooooooooooooooooooooongParam =
                    1) then
                    return failwith "xxx"
            }

        ()

Problem description

Please describe here the Fantomas problem you encountered.
Check out our Contribution Guidelines.

Extra information

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

Options

Fantomas Master at 11/07/2020 09:02:01 - de55bd9

    { config with
                MaxLineLength = 80 }
@knocte
Copy link
Contributor Author

knocte commented Jan 7, 2021

@nojaf we're working on this but are confused as to what should be the expected result. Would it be this?:

module SomeModule =

    let SomeFunc () =
        let someLocalFunc
            someVeryLooooooooooooooooooooooooooooooooooooooooooooooooongParam
            =
            async {
                if (someVeryLooooooooooooooooooooooooooooooooooooooooooooooooongParam =
                     1) then
                    return failwith "xxx"
            }

        ()

The above doesn't make the compiler fail for me, but strucks me as strange. Is this maybe an F#-compiler bug?

/cc @btzo

@nojaf
Copy link
Contributor

nojaf commented Jan 8, 2021

Hey @knocte, I would expect the output to be:

module SomeModule =

    let SomeFunc () =
        let someLocalFunc
            someVeryLooooooooooooooooooooooooooooooooooooooooooooooooongParam
            =
            async {
                if (someVeryLooooooooooooooooooooooooooooooooooooooooooooooooongParam = 1) then
                    return failwith "xxx"
            }

        ()

I noticed the condition is being mistaken for a named argument from a constructor call in

| InfixApp (equal, operatorExpr, e1, e2) when (equal = "=") ->

Something like A(B = b).

Constructor invocations may need their own active pattern to be captured and processed accordingly in CodePrinter.
I'll try to revisit this as it was introduced during an infix operation refactoring.

@knocte
Copy link
Contributor Author

knocte commented Jan 8, 2021

I would expect the output to be:

I don't see the if's condition split in 2 lines, in your snippet; are you sure that respects the MaxLineLength?

@nojaf
Copy link
Contributor

nojaf commented Jan 8, 2021

It should follow:

genMultilineInfixExpr astContext e1 operatorText operatorExpr e2

And then go here
genOnelinerInfixExpr astContext e1 operatorText operatorExpr e2

as equals is part of
let internal noBreakInfixOps = set [ "="; ">"; "<"; "%" ]

@knocte
Copy link
Contributor Author

knocte commented Jan 8, 2021

@nojaf let's agree on the expected results first, before discussing implementation. The snippet that you have posted in #1241 (comment) doesn't split the if X then line in two, but fantomas has to do it, otherwise the MaxLineLength is not respected (whole point about this bug is related to this).

@nojaf
Copy link
Contributor

nojaf commented Jan 8, 2021

MaxLineLength cannot always be respected in combination with all other rules/settings across the entire tool.
= is part of noBreakInfixOps and that is not respected here as I explained, that is the problem for me.

Trying to split noBreakInfixOps operator to respect max line length will introduce a whole set of different issues in regards to operator precedence.

knocte added a commit to nblockchain/geewallet that referenced this issue Jan 17, 2021
Things I don't like:
         member __.GetLastCachedData (): CachedNetworkData =
             lock
                 cacheFiles.CachedNetworkData
-                (fun _ -> sessionCachedNetworkData)
+                (fun _ -> sessionCachedNetworkData
+                )

Things I should report (if not reported yet):
1)
Processing src/GWallet.Backend/Ether/EtherServer.fs
The following exception occurs while formatting stdin: Fantomas.FormatConfig+FormatException: Formatted content is not valid F# code
   at Fantomas.Extras.FakeHelpers.formatContentInternalAsync@95-5.Invoke(Boolean _arg2) in C:\Users\nojaf\Projects\fantomas\src\Fantomas.Extras\FakeHelpers.fs:line 96
   at Microsoft.FSharp.Control.AsyncPrimitives.CallThenInvokeNoHijackCheck[a,b](AsyncActivation`1 ctxt, FSharpFunc`2 userCode, b result1) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 404
   at [email protected](AsyncActivation`1 ctxt) in C:\Users\nojaf\Projects\fantomas\src\Fantomas\CodeFormatterImpl.fs:line 378
   at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc`2 firstAction) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 104
--- End of stack trace from previous location ---
   at Microsoft.FSharp.Control.AsyncResult`1.Commit() in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 337
   at Microsoft.FSharp.Control.AsyncPrimitives.RunSynchronouslyInCurrentThread[a](CancellationToken cancellationToken, FSharpAsync`1 computation) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 870
   at Microsoft.FSharp.Control.AsyncPrimitives.RunSynchronously[T](CancellationToken cancellationToken, FSharpAsync`1 computation, FSharpOption`1 timeout) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 878
   at Microsoft.FSharp.Control.FSharpAsync.RunSynchronously[T](FSharpAsync`1 computation, FSharpOption`1 timeout, FSharpOption`1 cancellationToken) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 1142
   at Program.processSourceString(Boolean isFsiFile, String s, FSharpChoice`2 tw, FormatConfig config) in C:\Users\nojaf\Projects\fantomas\src\Fantomas.CoreGlobalTool\Program.fs:line 113
   at Program.stringToFile@310(Boolean force, Boolean profile, String s, String outFile, FormatConfig config) in C:\Users\nojaf\Projects\fantomas\src\Fantomas.CoreGlobalTool\Program.fs:line 322

2)
Processing src/GWallet.Backend/FaultTolerantParallelClient.fs
The following exception occurs while formatting stdin: Fantomas.FormatConfig+FormatException: Formatted content is not valid F# code
   at Fantomas.Extras.FakeHelpers.formatContentInternalAsync@95-5.Invoke(Boolean _arg2) in C:\Users\nojaf\Projects\fantomas\src\Fantomas.Extras\FakeHelpers.fs:line 96
   at Microsoft.FSharp.Control.AsyncPrimitives.CallThenInvokeNoHijackCheck[a,b](AsyncActivation`1 ctxt, FSharpFunc`2 userCode, b result1) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 404
   at [email protected](AsyncActivation`1 ctxt) in C:\Users\nojaf\Projects\fantomas\src\Fantomas\CodeFormatterImpl.fs:line 378
   at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc`2 firstAction) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 104
--- End of stack trace from previous location ---
   at Microsoft.FSharp.Control.AsyncResult`1.Commit() in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 337
   at Microsoft.FSharp.Control.AsyncPrimitives.RunSynchronouslyInCurrentThread[a](CancellationToken cancellationToken, FSharpAsync`1 computation) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 870
   at Microsoft.FSharp.Control.AsyncPrimitives.RunSynchronously[T](CancellationToken cancellationToken, FSharpAsync`1 computation, FSharpOption`1 timeout) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 878
   at Microsoft.FSharp.Control.FSharpAsync.RunSynchronously[T](FSharpAsync`1 computation, FSharpOption`1 timeout, FSharpOption`1 cancellationToken) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 1142
   at Program.processSourceString(Boolean isFsiFile, String s, FSharpChoice`2 tw, FormatConfig config) in C:\Users\nojaf\Projects\fantomas\src\Fantomas.CoreGlobalTool\Program.fs:line 113
   at Program.stringToFile@310(Boolean force, Boolean profile, String s, String outFile, FormatConfig config) in C:\Users\nojaf\Projects\fantomas\src\Fantomas.CoreGlobalTool\Program.fs:line 322

NOTE: one of these two above may be fsprojects/fantomas#1241
knocte added a commit to nblockchain/geewallet that referenced this issue Jan 17, 2021
Things I don't like:
1) are we sure it cannot be in a single line?:
         member __.GetLastCachedData (): CachedNetworkData =
             lock
                 cacheFiles.CachedNetworkData
-                (fun _ -> sessionCachedNetworkData)
+                (fun _ -> sessionCachedNetworkData
+                )

2) are we sure it cannot be in a single line?:
            raise
                (TlsNotSupportedYetInGWalletException ("TLS not yet supported"))
            raise (
                TlsNotSupportedYetInGWalletException ("TLS not yet supported")
            )

Things I should report (if not reported yet):
1)
Processing src/GWallet.Backend/Ether/EtherServer.fs
The following exception occurs while formatting stdin: Fantomas.FormatConfig+FormatException: Formatted content is not valid F# code
   at Fantomas.Extras.FakeHelpers.formatContentInternalAsync@95-5.Invoke(Boolean _arg2) in C:\Users\nojaf\Projects\fantomas\src\Fantomas.Extras\FakeHelpers.fs:line 96
   at Microsoft.FSharp.Control.AsyncPrimitives.CallThenInvokeNoHijackCheck[a,b](AsyncActivation`1 ctxt, FSharpFunc`2 userCode, b result1) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 404
   at [email protected](AsyncActivation`1 ctxt) in C:\Users\nojaf\Projects\fantomas\src\Fantomas\CodeFormatterImpl.fs:line 378
   at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc`2 firstAction) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 104
--- End of stack trace from previous location ---
   at Microsoft.FSharp.Control.AsyncResult`1.Commit() in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 337
   at Microsoft.FSharp.Control.AsyncPrimitives.RunSynchronouslyInCurrentThread[a](CancellationToken cancellationToken, FSharpAsync`1 computation) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 870
   at Microsoft.FSharp.Control.AsyncPrimitives.RunSynchronously[T](CancellationToken cancellationToken, FSharpAsync`1 computation, FSharpOption`1 timeout) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 878
   at Microsoft.FSharp.Control.FSharpAsync.RunSynchronously[T](FSharpAsync`1 computation, FSharpOption`1 timeout, FSharpOption`1 cancellationToken) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 1142
   at Program.processSourceString(Boolean isFsiFile, String s, FSharpChoice`2 tw, FormatConfig config) in C:\Users\nojaf\Projects\fantomas\src\Fantomas.CoreGlobalTool\Program.fs:line 113
   at Program.stringToFile@310(Boolean force, Boolean profile, String s, String outFile, FormatConfig config) in C:\Users\nojaf\Projects\fantomas\src\Fantomas.CoreGlobalTool\Program.fs:line 322

2)
Processing src/GWallet.Backend/FaultTolerantParallelClient.fs
The following exception occurs while formatting stdin: Fantomas.FormatConfig+FormatException: Formatted content is not valid F# code
   at Fantomas.Extras.FakeHelpers.formatContentInternalAsync@95-5.Invoke(Boolean _arg2) in C:\Users\nojaf\Projects\fantomas\src\Fantomas.Extras\FakeHelpers.fs:line 96
   at Microsoft.FSharp.Control.AsyncPrimitives.CallThenInvokeNoHijackCheck[a,b](AsyncActivation`1 ctxt, FSharpFunc`2 userCode, b result1) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 404
   at [email protected](AsyncActivation`1 ctxt) in C:\Users\nojaf\Projects\fantomas\src\Fantomas\CodeFormatterImpl.fs:line 378
   at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc`2 firstAction) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 104
--- End of stack trace from previous location ---
   at Microsoft.FSharp.Control.AsyncResult`1.Commit() in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 337
   at Microsoft.FSharp.Control.AsyncPrimitives.RunSynchronouslyInCurrentThread[a](CancellationToken cancellationToken, FSharpAsync`1 computation) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 870
   at Microsoft.FSharp.Control.AsyncPrimitives.RunSynchronously[T](CancellationToken cancellationToken, FSharpAsync`1 computation, FSharpOption`1 timeout) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 878
   at Microsoft.FSharp.Control.FSharpAsync.RunSynchronously[T](FSharpAsync`1 computation, FSharpOption`1 timeout, FSharpOption`1 cancellationToken) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 1142
   at Program.processSourceString(Boolean isFsiFile, String s, FSharpChoice`2 tw, FormatConfig config) in C:\Users\nojaf\Projects\fantomas\src\Fantomas.CoreGlobalTool\Program.fs:line 113
   at Program.stringToFile@310(Boolean force, Boolean profile, String s, String outFile, FormatConfig config) in C:\Users\nojaf\Projects\fantomas\src\Fantomas.CoreGlobalTool\Program.fs:line 322

NOTE: one of these two above may be fsprojects/fantomas#1241

3)
D:\a\geewallet\geewallet\src\GWallet.Backend\UtxoCoin\UtxoCoinAccount.fs(639,13): error FS0058: Possible incorrect indentation: this token is offside of context started at position (638:13). Try indenting this token further or using standard formatting conventions. [D:\a\geewallet\geewallet\src\GWallet.Backend\GWallet.Backend.fsproj]
  D:\a\geewallet\geewallet\src\GWallet.Backend\UtxoCoin\UtxoCoinAccount.fs(639,13): error FS0058: Possible incorrect indentation: this token is offside of context started at position (638:13). Try indenting this token further or using standard formatting conventions. [D:\a\geewallet\geewallet\src\GWallet.Backend\GWallet.Backend.fsproj]
  D:\a\geewallet\geewallet\src\GWallet.Backend\UtxoCoin\UtxoCoinAccount.fs(640,13): error FS0058: Possible incorrect indentation: this token is offside of context started at position (638:13). Try indenting this token further or using standard formatting conventions. [D:\a\geewallet\geewallet\src\GWallet.Backend\GWallet.Backend.fsproj]
  D:\a\geewallet\geewallet\src\GWallet.Backend\UtxoCoin\UtxoCoinAccount.fs(640,13): error FS0058: Possible incorrect indentation: this token is offside of context started at position (638:13). Try indenting this token further or using standard formatting conventions. [D:\a\geewallet\geewallet\src\GWallet.Backend\GWallet.Backend.fsproj]
  D:\a\geewallet\geewallet\src\GWallet.Backend\Ether\EtherAccount.fs(582,13): error FS0058: Possible incorrect indentation: this token is offside of context started at position (581:13). Try indenting this token further or using standard formatting conventions. [D:\a\geewallet\geewallet\src\GWallet.Backend\GWallet.Backend.fsproj]
  D:\a\geewallet\geewallet\src\GWallet.Backend\Ether\EtherAccount.fs(582,13): error FS0058: Possible incorrect indentation: this token is offside of context started at position (581:13). Try indenting this token further or using standard formatting conventions. [D:\a\geewallet\geewallet\src\GWallet.Backend\GWallet.Backend.fsproj]
  D:\a\geewallet\geewallet\src\GWallet.Backend\Ether\EtherAccount.fs(583,13): error FS0058: Possible incorrect indentation: this token is offside of context started at position (581:13). Try indenting this token further or using standard formatting conventions. [D:\a\geewallet\geewallet\src\GWallet.Backend\GWallet.Backend.fsproj]
  D:\a\geewallet\geewallet\src\GWallet.Backend\Ether\EtherAccount.fs(583,13): error FS0058: Possible incorrect indentation: this token is offside of context started at position (581:13). Try indenting this token further or using standard formatting conventions. [D:\a\geewallet\geewallet\src\GWallet.Backend\GWallet.Backend.fsproj]
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\MSBuild.exe build failed
  D:\a\geewallet\geewallet\src\GWallet.Backend\Account.fs(489,13): error FS0058: Possible incorrect indentation: this token is offside of context started at position (488:13). Try indenting this token further or using standard formatting conventions. [D:\a\geewallet\geewallet\src\GWallet.Backend\GWallet.Backend.fsproj]
  D:\a\geewallet\geewallet\src\GWallet.Backend\Account.fs(489,13): error FS0058: Possible incorrect indentation: this token is offside of context started at position (488:13). Try indenting this token further or using standard formatting conventions. [D:\a\geewallet\geewallet\src\GWallet.Backend\GWallet.Backend.fsproj]
  D:\a\geewallet\geewallet\src\GWallet.Backend\Account.fs(490,13): error FS0058: Possible incorrect indentation: this token is offside of context started at position (488:13). Try indenting this token further or using standard formatting conventions. [D:\a\geewallet\geewallet\src\GWallet.Backend\GWallet.Backend.fsproj]
  D:\a\geewallet\geewallet\src\GWallet.Backend\Account.fs(490,13): error FS0058: Possible incorrect indentation: this token is offside of context started at position (488:13). Try indenting this token further or using standard formatting conventions. [D:\a\geewallet\geewallet\src\GWallet.Backend\GWallet.Backend.fsproj]
@btzo
Copy link
Contributor

btzo commented Jan 20, 2021

Hey @nojaf ,

Constructor invocations may need their own active pattern to be captured and processed accordingly in CodePrinter.

You could elaborate this part please.
Today at SourceParser.fs, the only reference for a constructor I see is the MFConstructor.

/// This pattern finds out which keyword to use
let (|MFMember|MFStaticMember|MFConstructor|MFOverride|) (mf: MemberFlags) =
match mf.MemberKind with
| MemberKind.ClassConstructor
| MemberKind.Constructor -> MFConstructor()
| MemberKind.Member
| MemberKind.PropertyGet
| MemberKind.PropertySet
| MemberKind.PropertyGetSet as mk ->

but it seems to me that it only serves to decide which keyword to use in each case in a Pattern.

Also, I can't find anything explicit for the treatment of a Constructor in the documentation of the SynExpr.

Maybe the New and ObjExpr expressions?

@nojaf
Copy link
Contributor

nojaf commented Jan 20, 2021

Hey Mike, I'll get back to you on Friday.

@nojaf
Copy link
Contributor

nojaf commented Jan 22, 2021

Hey @btzo, I added the fix myself, as well I'm the culprit who introduced it.
I've explained a bit about what happened in the PR description if you are interested.
Thanks again for showing interest in solving this.

nojaf added a commit that referenced this issue Jan 22, 2021
* Remove invalid check for named arguments. Fixes #1241.

* Move named arguments to NewTuple pattern.
@btzo
Copy link
Contributor

btzo commented Jan 22, 2021

Cool, I'll read the PR

knocte added a commit to nblockchain/geewallet that referenced this issue Jan 24, 2021
NEW OBSERVATIONS:

this is still vanity alignment:
-                .ComposeInputDataForTransferTransaction(origin, destination, amountInWei, gasLimit)
+                .ComposeInputDataForTransferTransaction(origin,
+                                                        destination,
+                                                        amountInWei,
+                                                        gasLimit)

this still causes indent warnings:

"/Users/knocte/Documents/Code/geewalletMASTERfantomas/gwallet.sln" (default target) (1) ->
"/Users/knocte/Documents/Code/geewalletMASTERfantomas/src/GWallet.Backend/GWallet.Backend.fsproj" (default target) (2) ->
(CoreCompile target) ->
  /Users/knocte/Documents/Code/geewalletMASTERfantomas/src/GWallet.Backend/Ether/EtherServer.fs(283,25): warning FS0058: Possible incorrect indentation: this token is offside of context started at position (282:25). Try indenting this token further or using standard formatting conventions. [/Users/knocte/Documents/Code/geewalletMASTERfantomas/src/GWallet.Backend/GWallet.Backend.fsproj]
  /Users/knocte/Documents/Code/geewalletMASTERfantomas/src/GWallet.Backend/Ether/EtherServer.fs(283,25): warning FS0058: Possible incorrect indentation: this token is offside of context started at position (282:25). Try indenting this token further or using standard formatting conventions. [/Users/knocte/Documents/Code/geewalletMASTERfantomas/src/GWallet.Backend/GWallet.Backend.fsproj]
  /Users/knocte/Documents/Code/geewalletMASTERfantomas/src/GWallet.Backend/Ether/EtherServer.fs(287,28): warning FS0058: Possible incorrect indentation: this token is offside of context started at position (286:28). Try indenting this token further or using standard formatting conventions. [/Users/knocte/Documents/Code/geewalletMASTERfantomas/src/GWallet.Backend/GWallet.Backend.fsproj]
  /Users/knocte/Documents/Code/geewalletMASTERfantomas/src/GWallet.Backend/Ether/EtherServer.fs(287,28): warning FS0058: Possible incorrect indentation: this token is offside of context started at position (286:28). Try indenting this token further or using standard formatting conventions. [/Users/knocte/Documents/Code/geewalletMASTERfantomas/src/GWallet.Backend/GWallet.Backend.fsproj]
  /Users/knocte/Documents/Code/geewalletMASTERfantomas/src/GWallet.Backend/Ether/EtherServer.fs(291,28): warning FS0058: Possible incorrect indentation: this token is offside of context started at position (290:28). Try indenting this token further or using standard formatting conventions. [/Users/knocte/Documents/Code/geewalletMASTERfantomas/src/GWallet.Backend/GWallet.Backend.fsproj]
  /Users/knocte/Documents/Code/geewalletMASTERfantomas/src/GWallet.Backend/Ether/EtherServer.fs(291,28): warning FS0058: Possible incorrect indentation: this token is offside of context started at position (290:28). Try indenting this token further or using standard formatting conventions. [/Users/knocte/Documents/Code/geewalletMASTERfantomas/src/GWallet.Backend/GWallet.Backend.fsproj]

    6 Warning(s)
    0 Error(s)

REVIEW MERGED commit messages from prev history:

Update fantomas to 4.3.0-alpha-002-alpha-043

    dotnet tool install -g fantomas-tool --add-source https://www.myget.org/F/fantomas/api/v3/index.json --framework netcoreapp3.1 --version 4.3.0-alpha-002-alpha-043

    New bugs:
    fsprojects/fantomas#1223
    fsprojects/fantomas#1226
    fsprojects/fantomas#1220
    fsprojects/fantomas#1219
    fsprojects/fantomas#1222

    Fix .editorconfig file

    Things to report:
    - this is ugly:

    -                monoRuntime.GetMethod ("GetDisplayName", BindingFlags.NonPublic ||| BindingFlags.Static)
    +                monoRuntime.GetMethod
    +                    ("GetDisplayName",
    +                     BindingFlags.NonPublic ||| BindingFlags.Static)

    - this cut is bad because it seems to place it at the same offset:
             match electrumServer.ServerInfo.ConnectionType with
             | { Encrypted = true
    -            Protocol = _ } -> failwith "Incompatibility filter for non-encryption didn't work?"
    +            Protocol = _ } ->
    +            failwith "Incompatibility filter for non-encryption didn't work?"

    - this should make it end with |> Some:
             let consistencyConfig =
                 if mode = ServerSelectionMode.Fast then
    -                Some (OneServerConsistentWithCertainValueOrTwoServers cacheOrInitialBalanceMatchFunc)
    +                Some
    +                    (OneServerConsistentWithCertainValueOrTwoServers
    +                        cacheOrInitialBalanceMatchFunc)

    New setting in 4.3.0-beta-001

    This version is installed this way:
    dotnet tool install -g fantomas-tool --framework net5.0 --version 4.3.0-beta-001

    But can't run it yet myself.

    new setting in 4.3.0-alpha-005

    see fsprojects/fantomas@83ac83b

    Update fantomas to v4.4.0-alpha-008

    Things I don't like:
    1) are we sure it cannot be in a single line?:
             member __.GetLastCachedData (): CachedNetworkData =
                 lock
                     cacheFiles.CachedNetworkData
    -                (fun _ -> sessionCachedNetworkData)
    +                (fun _ -> sessionCachedNetworkData
    +                )

    2) are we sure it cannot be in a single line?:
                raise
                    (TlsNotSupportedYetInGWalletException ("TLS not yet supported"))
                raise (
                    TlsNotSupportedYetInGWalletException ("TLS not yet supported")
                )

    Things I should report (if not reported yet):
    1)
    Processing src/GWallet.Backend/Ether/EtherServer.fs
    The following exception occurs while formatting stdin: Fantomas.FormatConfig+FormatException: Formatted content is not valid F# code
       at Fantomas.Extras.FakeHelpers.formatContentInternalAsync@95-5.Invoke(Boolean _arg2) in C:\Users\nojaf\Projects\fantomas\src\Fantomas.Extras\FakeHelpers.fs:line 96
       at Microsoft.FSharp.Control.AsyncPrimitives.CallThenInvokeNoHijackCheck[a,b](AsyncActivation`1 ctxt, FSharpFunc`2 userCode, b result1) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 404
       at [email protected](AsyncActivation`1 ctxt) in C:\Users\nojaf\Projects\fantomas\src\Fantomas\CodeFormatterImpl.fs:line 378
       at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc`2 firstAction) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 104
    --- End of stack trace from previous location ---
       at Microsoft.FSharp.Control.AsyncResult`1.Commit() in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 337
       at Microsoft.FSharp.Control.AsyncPrimitives.RunSynchronouslyInCurrentThread[a](CancellationToken cancellationToken, FSharpAsync`1 computation) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 870
       at Microsoft.FSharp.Control.AsyncPrimitives.RunSynchronously[T](CancellationToken cancellationToken, FSharpAsync`1 computation, FSharpOption`1 timeout) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 878
       at Microsoft.FSharp.Control.FSharpAsync.RunSynchronously[T](FSharpAsync`1 computation, FSharpOption`1 timeout, FSharpOption`1 cancellationToken) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 1142
       at Program.processSourceString(Boolean isFsiFile, String s, FSharpChoice`2 tw, FormatConfig config) in C:\Users\nojaf\Projects\fantomas\src\Fantomas.CoreGlobalTool\Program.fs:line 113
       at Program.stringToFile@310(Boolean force, Boolean profile, String s, String outFile, FormatConfig config) in C:\Users\nojaf\Projects\fantomas\src\Fantomas.CoreGlobalTool\Program.fs:line 322

    2)
    Processing src/GWallet.Backend/FaultTolerantParallelClient.fs
    The following exception occurs while formatting stdin: Fantomas.FormatConfig+FormatException: Formatted content is not valid F# code
       at Fantomas.Extras.FakeHelpers.formatContentInternalAsync@95-5.Invoke(Boolean _arg2) in C:\Users\nojaf\Projects\fantomas\src\Fantomas.Extras\FakeHelpers.fs:line 96
       at Microsoft.FSharp.Control.AsyncPrimitives.CallThenInvokeNoHijackCheck[a,b](AsyncActivation`1 ctxt, FSharpFunc`2 userCode, b result1) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 404
       at [email protected](AsyncActivation`1 ctxt) in C:\Users\nojaf\Projects\fantomas\src\Fantomas\CodeFormatterImpl.fs:line 378
       at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc`2 firstAction) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 104
    --- End of stack trace from previous location ---
       at Microsoft.FSharp.Control.AsyncResult`1.Commit() in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 337
       at Microsoft.FSharp.Control.AsyncPrimitives.RunSynchronouslyInCurrentThread[a](CancellationToken cancellationToken, FSharpAsync`1 computation) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 870
       at Microsoft.FSharp.Control.AsyncPrimitives.RunSynchronously[T](CancellationToken cancellationToken, FSharpAsync`1 computation, FSharpOption`1 timeout) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 878
       at Microsoft.FSharp.Control.FSharpAsync.RunSynchronously[T](FSharpAsync`1 computation, FSharpOption`1 timeout, FSharpOption`1 cancellationToken) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 1142
       at Program.processSourceString(Boolean isFsiFile, String s, FSharpChoice`2 tw, FormatConfig config) in C:\Users\nojaf\Projects\fantomas\src\Fantomas.CoreGlobalTool\Program.fs:line 113
       at Program.stringToFile@310(Boolean force, Boolean profile, String s, String outFile, FormatConfig config) in C:\Users\nojaf\Projects\fantomas\src\Fantomas.CoreGlobalTool\Program.fs:line 322

    NOTE: one of these two above may be fsprojects/fantomas#1241

    3)
    D:\a\geewallet\geewallet\src\GWallet.Backend\UtxoCoin\UtxoCoinAccount.fs(639,13): error FS0058: Possible incorrect indentation: this token is offside of context started at position (638:13). Try indenting this token further or using standard formatting conventions. [D:\a\geewallet\geewallet\src\GWallet.Backend\GWallet.Backend.fsproj]
      D:\a\geewallet\geewallet\src\GWallet.Backend\UtxoCoin\UtxoCoinAccount.fs(639,13): error FS0058: Possible incorrect indentation: this token is offside of context started at position (638:13). Try indenting this token further or using standard formatting conventions. [D:\a\geewallet\geewallet\src\GWallet.Backend\GWallet.Backend.fsproj]
      D:\a\geewallet\geewallet\src\GWallet.Backend\UtxoCoin\UtxoCoinAccount.fs(640,13): error FS0058: Possible incorrect indentation: this token is offside of context started at position (638:13). Try indenting this token further or using standard formatting conventions. [D:\a\geewallet\geewallet\src\GWallet.Backend\GWallet.Backend.fsproj]
      D:\a\geewallet\geewallet\src\GWallet.Backend\UtxoCoin\UtxoCoinAccount.fs(640,13): error FS0058: Possible incorrect indentation: this token is offside of context started at position (638:13). Try indenting this token further or using standard formatting conventions. [D:\a\geewallet\geewallet\src\GWallet.Backend\GWallet.Backend.fsproj]
      D:\a\geewallet\geewallet\src\GWallet.Backend\Ether\EtherAccount.fs(582,13): error FS0058: Possible incorrect indentation: this token is offside of context started at position (581:13). Try indenting this token further or using stan       at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc`2 firstAction) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 104
    --- End of stack trace from previous location ---
       at Microsoft.FSharp.Control.AsyncResult`1.Commit() in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 337
       at Microsoft.FSharp.Control.AsyncPrimitives.RunSynchronouslyInCurrentThread[a](CancellationToken cancellationToken, FSharpAsync`1 computation) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 870
       at Microsoft.FSharp.Control.AsyncPrimitives.RunSynchronously[T](CancellationToken cancellationToken, FSharpAsync`1 computation, FSharpOption`1 timeout) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 878
       at Microsoft.FSharp.Control.FSharpAsync.RunSynchronously[T](FSharpAsync`1 computation, FSharpOption`1 timeout, FSharpOption`1 cancellationToken) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 1142
       at Program.processSourceString(Boolean isFsiFile, String s, FSharpChoice`2 tw, FormatConfig config) in C:\Users\nojaf\Projects\fantomas\src\Fantomas.CoreGlobalTool\Program.fs:line 113
       at Program.stringToFile@310(Boolean force, Boolean profile, String s, String outFile, FormatConfig config) in C:\Users\nojaf\Projects\fantomas\src\Fantomas.CoreGlobalTool\Program.fs:line 322

    NOTE: one of these two above may be fsprojects/fantomas#1241

    3)
    D:\a\geewallet\geewallet\src\GWallet.Backend\UtxoCoin\UtxoCoinAccount.fs(639,13): error FS0058: Possible incorrect indentation: this token is offside of context started at position (638:13). Try indenting this token further or using
standard formatting conventions. [D:\a\geewallet\geewallet\src\GWallet.Backend\GWallet.Backend.fsproj]
      D:\a\geewallet\geewallet\src\GWallet.Backend\UtxoCoin\UtxoCoinAccount.fs(639,13): error FS0058: Possible incorrect indentation: this token is offside of context started at position (638:13). Try indenting this token further or usin
g standard formatting conventions. [D:\a\geewallet\geewallet\src\GWallet.Backend\GWallet.Backend.fsproj]
      D:\a\geewallet\geewallet\src\GWallet.Backend\UtxoCoin\UtxoCoinAccount.fs(640,13): error FS0058: Possible incorrect indentation: this token is offside of context started at position (638:13). Try indenting this token further or usin
g standard formatting conventions. [D:\a\geewallet\geewallet\src\GWallet.Backend\GWallet.Backend.fsproj]
      D:\a\geewallet\geewallet\src\GWallet.Backend\UtxoCoin\UtxoCoinAccount.fs(640,13): error FS0058: Possible incorrect indentation: this token is offside of context started at position (638:13). Try indenting this token further or usin
g standard formatting conventions. [D:\a\geewallet\geewallet\src\GWallet.Backend\GWallet.Backend.fsproj]
      D:\a\geewallet\geewallet\src\GWallet.Backend\Ether\EtherAccount.fs(582,13): error FS0058: Possible incorrect indentation: this token is offside of context started at position (581:13). Try indenting this token further or using stan
dard formatting conventions. [D:\a\geewallet\geewallet\src\GWallet.Backend\GWallet.Backend.fsproj]
      D:\a\geewallet\geewallet\src\GWallet.Backend\Ether\EtherAccount.fs(582,13): error FS0058: Possible incorrect indentation: this token is offside of context started at position (581:13). Try indenting this token further or using standard formatting conventions. [D:\a\geewallet\geewallet\src\GWallet.Backend\GWallet.Backend.fsproj]
      D:\a\geewallet\geewallet\src\GWallet.Backend\Ether\EtherAccount.fs(583,13): error FS0058: Possible incorrect indentation: this token is offside of context started at position (581:13). Try indenting this token further or using standard formatting conventions. [D:\a\geewallet\geewallet\src\GWallet.Backend\GWallet.Backend.fsproj]
      D:\a\geewallet\geewallet\src\GWallet.Backend\Ether\EtherAccount.fs(583,13): error FS0058: Possible incorrect indentation: this token is offside of context started at position (581:13). Try indenting this token further or using standard formatting conventions. [D:\a\geewallet\geewallet\src\GWallet.Backend\GWallet.Backend.fsproj]
    C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\MSBuild.exe build failed
      D:\a\geewallet\geewallet\src\GWallet.Backend\Account.fs(489,13): error FS0058: Possible incorrect indentation: this token is offside of context started at position (488:13). Try indenting this token further or using standard formatting conventions. [D:\a\geewallet\geewallet\src\GWallet.Backend\GWallet.Backend.fsproj]
      D:\a\geewallet\geewallet\src\GWallet.Backend\Account.fs(489,13): error FS0058: Possible incorrect indentation: this token is offside of context started at position (488:13). Try indenting this token further or using standard formatting conventions. [D:\a\geewallet\geewallet\src\GWallet.Backend\GWallet.Backend.fsproj]
      D:\a\geewallet\geewallet\src\GWallet.Backend\Account.fs(490,13): error FS0058: Possible incorrect indentation: this token is offside of context started at position (488:13). Try indenting this token further or using standard formatting conventions. [D:\a\geewallet\geewallet\src\GWallet.Backend\GWallet.Backend.fsproj]
      D:\a\geewallet\geewallet\src\GWallet.Backend\Account.fs(490,13): error FS0058: Possible incorrect indentation: this token is offside of context started at position (488:13). Try indenting this token further or using standard formatting conventions. [D:\a\geewallet\geewallet\src\GWallet.Backend\GWallet.Backend.fsproj]
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.

3 participants