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

An option to preserve empty lines between logical blocks #496

Closed
breki opened this issue Oct 3, 2019 · 1 comment
Closed

An option to preserve empty lines between logical blocks #496

breki opened this issue Oct 3, 2019 · 1 comment

Comments

@breki
Copy link

breki commented Oct 3, 2019

Description

I tend to add empty lines between logical blocks of code inside functions so the code is more legible (it's a matter of taste, I know, but I imagine I'm not the only one doing this). Unfortunately Fantomas removes these empty lines (and using PreserveEndOfLine is an overkill).

Repro code

Example code:

    let runValidator (validator: ResultFunc<'Input,'Output,'TError>) input =
        let validatorResult = validator input
        match validatorResult with
        | Error error -> 
            anyErrors <- true
            collectedErrors <- error :: collectedErrors
        | Ok output ->
            collectedOutputs <- output :: collectedOutputs

    funcs 
    |> Seq.iter(fun validator -> runValidator validator input)

    match anyErrors with
    | true -> Error collectedErrors
    | false -> Ok collectedOutputs

gets formatted to

    let runValidator (validator : ResultFunc<'Input, 'Output, 'TError>) input =
        let validatorResult = validator input
        match validatorResult with
        | Error error ->
            anyErrors <- true
            collectedErrors <- error :: collectedErrors
        | Ok output -> collectedOutputs <- output :: collectedOutputs
    funcs |> Seq.iter (fun validator -> runValidator validator input)
    match anyErrors with
    | true -> Error collectedErrors
    | false -> Ok collectedOutputs
@jindraivanek
Copy link
Contributor

Fantomas 3.0 keeps empty newlines by default: link.

Please re-open if you find another problematic case.

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

2 participants