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

Bug report from fantomas-ui - creates invalid F# for string handling operations #365

Closed
cgravill opened this issue Nov 23, 2018 · 0 comments

Comments

@cgravill
Copy link
Member

Issue created from fantomas-ui

This is a minimal reproduction of an issue with string handling code in a more complex code base. Fantomas forced .PadLeft(9) onto a new line, then when re-run got the positioning off which leads to compilation failures.

Code

let x =
    [| 1..2 |]
    |> Array.mapi (fun _ _ ->
        let num =
            ""
                .PadLeft(9)
        num)

Error

let x =
    [| 1..2 |]
    |> Array.mapi (fun _ _ ->
           let num = ""
                   .PadLeft(9)
           num)

Options

Fantomas 2.9.1

Name Value
IndentSpaceNum 4
PageWidth 80
PreserveEndOfLine false
SemicolonAtEndOfLine false
SpaceBeforeArgument true
SpaceBeforeColon true
SpaceAfterComma true
SpaceAfterSemicolon true
IndentOnTryWith false
ReorderOpenDeclaration false
SpaceAroundDelimiter true
StrictMode false

Most of our code works really well with Fantomas, thanks!

Variations also lead to exceptions when run via FAKE:

Script reported an error:
-> BuildFailedException: Target 'FormatCode' failed.
-> One or more errors occurred. (Exception of type 'Fantomas.FakeHelpers+CodeFormatException' was thrown.)
-> CodeFormatException: Exception of type 'Fantomas.FakeHelpers+CodeFormatException' was thrown.
@jindraivanek jindraivanek mentioned this issue Jan 23, 2019
nojaf pushed a commit that referenced this issue Jan 23, 2019
futureNlnCheck works correctly with empty string
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants