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

Long function definition should put equals and body on a newline #740

Closed
nojaf opened this issue Apr 3, 2020 · 0 comments
Closed

Long function definition should put equals and body on a newline #740

nojaf opened this issue Apr 3, 2020 · 0 comments

Comments

@nojaf
Copy link
Contributor

nojaf commented Apr 3, 2020

Issue created from fantomas-ui

The = and Http.main ... should be on the next line.

If the return type is declared, the behaviour is correct.

module FormatCode =

    open System.Net.Http

    let private format filename code config =
        let checker = Fantomas.FakeHelpers.sharedChecker.Force()
        let options = Fantomas.FakeHelpers.createParsingOptionsFromFile filename
        let source = SourceOrigin.SourceString code
        CodeFormatter.FormatDocumentAsync("tmp.fsx", source, config, options, checker)


    [<FunctionName("FormatCode")>]
    let run
        ([<HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = "{*any}")>] req: HttpRequest)
        (log: ILogger)
        : Async<HttpResponseMessage>
        = Http.main CodeFormatter.GetVersion format FormatConfig.FormatConfig.Default log req

Code

module FormatCode =

    let private format filename code config =
        let checker = Fantomas.FakeHelpers.sharedChecker.Force()
        let options = Fantomas.FakeHelpers.createParsingOptionsFromFile filename
        let source = SourceOrigin.SourceString code
        CodeFormatter.FormatDocumentAsync("tmp.fsx", source, config, options, checker)


    [<FunctionName("FormatCode")>]
    let run ([<HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = "{*any}")>] req: HttpRequest) (log: ILogger) = Http.main CodeFormatter.GetVersion format FormatConfig.FormatConfig.Default log req

Result

module FormatCode =

    let private format filename code config =
        let checker = Fantomas.FakeHelpers.sharedChecker.Force()
        let options = Fantomas.FakeHelpers.createParsingOptionsFromFile filename
        let source = SourceOrigin.SourceString code
        CodeFormatter.FormatDocumentAsync("tmp.fsx", source, config, options, checker)


    [<FunctionName("FormatCode")>]
    let run
        ([<HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = "{*any}")>] req: HttpRequest)
        (log: ILogger) = Http.main CodeFormatter.GetVersion format FormatConfig.FormatConfig.Default log req

Options

Fantomas Next - 3.3.0-3/26/2020

Name Value
IndentOnTryWith false
IndentSpaceNum 4
KeepNewlineAfter false
MaxIfThenElseShortWidth 40
PageWidth 120
ReorderOpenDeclaration false
SemicolonAtEndOfLine false
SpaceAfterComma true
SpaceAfterSemicolon true
SpaceAroundDelimiter true
SpaceBeforeClassConstructor false
SpaceBeforeColon false
SpaceBeforeLowercaseInvocation true
SpaceBeforeMember false
SpaceBeforeParameter true
SpaceBeforeSemicolon false
SpaceBeforeUppercaseInvocation false
StrictMode false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant