-
-
Notifications
You must be signed in to change notification settings - Fork 193
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
Fantomas keeps adding new lines between two interface member implementations #569
Comments
Minimal repro I could come up with: https://jindraivanek.gitlab.io/fantomas-ui/#?code=C4TwDgpgBAggFASigXgFCqpqBbC2BGEATlMABYCWAzgHQCyehRMKGW7FAZqUQK7TkIAOygAGKBAA2VaAEZ07XAWKlKtBsqIAhVuw7dgfAWWFQATBOnQAzAqxKmq6vUbEAwijGogA Codetype A() =
member this.MemberA =
if true then 0 else 1
member this.MemberB =
if true then 2 else 3
member this.MemberC = 0
Resulttype A() =
member this.MemberA =
if true then 0 else 1
member this.MemberB =
if true then 2 else 3
member this.MemberC = 0
OptionsFantomas 3.1.0
|
The problem here is that Fantomas adds a newline between each found So you end up with an extra newline. We have encountered this issue on other places as well. |
I started looking at that, but I'm completely new to the code so I can hardly understand anything yet. What I found is that there are two pattern matches on and for my above snippet I end up in the later one, while if I remove There are some differences in implementation between those two and I'm trying get my head around those |
Ok I think I got it - see PR #584 |
The pattern matching above uses nested `sepMember` function to consider Trivia Content. The difference between those pattern matching cases is that latter one matches on when there are trailing non-multiline members. There's some code duplication between those two now, which I'm happy to refactor - feedback welcome.
Description
Fantomas adds a new line between two interface member implementations each time the file is formatted
Repro code
The link to fantomas tool example.
You can check if you copy the formatted code from the right to the source and format that, it will add new line after line 17, and it keeps doing this forever.
The text was updated successfully, but these errors were encountered: