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

Object expression newline gets added/removed #1388

Closed
3 tasks
bddckr opened this issue Jan 23, 2021 · 2 comments · Fixed by #1389
Closed
3 tasks

Object expression newline gets added/removed #1388

bddckr opened this issue Jan 23, 2021 · 2 comments · Fixed by #1389

Comments

@bddckr
Copy link

bddckr commented Jan 23, 2021

Issue created from fantomas-online

Code

let test () =
    let something = "something"

    { new IDisposable with
        override this.Dispose() = dispose somethingElse }

Result

let test () =
    let something = "something"
    { new IDisposable with
        override this.Dispose() = dispose somethingElse }

Problem description

As seen, the newline is removed right before the let-binding above it. While I believe that change is questionable (Fantomas normally seems to keep multi-line object expressions as a "group" and thus separate with newlines), there is actually an issue after this is applied:
If you run Fantomas on the result again you'll be back with the original code, effectively going back and forth.

Extra information

  • The formatted result breaks by code.
  • The formatted result gives compiler warnings.
  • I or my company would be willing to help fix this.
    I'm currently unable to put aside the time it will take me to make my first contribution to this project, but I'd be thankful if anyone who is also unable to resolve this could leave a few pointers on where to look in the codebase for this issue.
    Nonetheless I want to thank everyone involved in this project for the great work!

Options

Fantomas Master at 01/23/2021 12:17:04 - 5317acd

Default Fantomas configuration

@bddckr bddckr changed the title <Insert meaningful title> Object expression newline gets added/removed Jan 23, 2021
nojaf added a commit to nojaf/fantomas that referenced this issue Jan 23, 2021
@nojaf
Copy link
Contributor

nojaf commented Jan 23, 2021

Hello @bddckr, thanks for reporting this issue.
I totally understand that you can't find the time to contribute.
The fix was quite easy, so I just went for it instead of explaining what's up.
Perhaps next time you can get your feet wet with some other bug.

@bddckr
Copy link
Author

bddckr commented Jan 23, 2021

Thanks a lot @nojaf! Looks like the contribution docs actually pointed out exactly the right things for this one 😄

Have a great rest of the weekend!

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

Successfully merging a pull request may close this issue.

2 participants