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

Repeated document formatting adds unnecessary new lines #1505

Closed
alarbada opened this issue Feb 28, 2021 · 4 comments
Closed

Repeated document formatting adds unnecessary new lines #1505

alarbada opened this issue Feb 28, 2021 · 4 comments

Comments

@alarbada
Copy link

Describe the bug**

Steps to reproduce

Have the following setup:

.editorconfig

[*.fs]
indent_size=4
fsharp_max_array_or_list_width=20
fsharp_max_elmish_width=10
fsharp_single_argument_web_mode=true
fsharp_multi_line_lambda_closing_newline=true
fsharp_record_multiline_formatter=number_of_items
fsharp_max_record_number_of_items=1
fsharp_disable_elmish_syntax=false

Some random file, App.fs for example:

[<ReactComponent>]
let Dashboard () =
    Html.div [
        Html.div [
        ]
        Html.div [
            Html.text "hola muy buenas"
        ]
    ]

And just Ctrl + Shift + I multiple times

Link to sample reproduction

I don't think it is necessary

Expected behaviour

To be formated like this:

[<ReactComponent>]
let Dashboard () =
    Html.div [
        Html.div []
        Html.div [
            Html.text "hola muy buenas"
        ]
    ]

However, it gets formated like this:

[<ReactComponent>]
let Dashboard () =
    Html.div [
        Html.div [

        ]
        Html.div [
            Html.text "hola muy buenas"
        ]
    ]

Which I really don't mind, but the issue is whenever I reformat again the document without changing anything, the format output adds new unnecessary lines:

[<ReactComponent>]
let Dashboard () =
    Html.div [
        Html.div [


        ]
        Html.div [
            Html.text "hola muy buenas"
        ]

    ]

// And on, and on...

[<ReactComponent>]
let Dashboard () =
    Html.div [
        Html.div [




        ]
        Html.div [
            Html.text "hola muy buenas"
        ]



    ]

After some testing I found out that just passing an array with a null inside instead of an empty array solves the issue, but I'd expect to work both ways as expected

Machine info

  • OS: Linux
  • .NET SDK version: 5.0.103
  • Ionide version: v5.3.2
@open-collective-bot
Copy link

Hey @not-rusty 👋,

Thank you for opening an issue. We will get back to you as
soon as we can. Also, check out our OpenCollective and consider
backing us.

https://opencollective.com/ionide

PS.: We offer backer support for all backers. Don't forget to add backer label when you start backing us 😄

@MangelMaxime
Copy link
Contributor

Hello @not-rusty,

Ionide is using Fantomas for the formatting. I think you should open the issue there so @nojaf and others can take a look at it.

@nojaf
Copy link
Contributor

nojaf commented Mar 4, 2021

Yes please, could you report an issue using https://fsprojects.github.io/fantomas-tools/#/fantomas/preview please?

@Krzysztof-Cieslak
Copy link
Member

Closing as an upstream issue.

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

4 participants