fsprojects / fantomas

FSharp source code formatter
https://fsprojects.github.io/fantomas
Other
770 stars 194 forks source link

Add additional newline when there is trivia after the opening parenthesis #2848

Closed nojaf closed 1 year ago

nojaf commented 1 year ago

Fixes #2847.

Hey @jindraivanek,

Thanks for the report. I have a fix for this problem, but I'm not sure this will never lead to any other problems.

On a side note, we currently don't immediately print the line comment after the source. This has been the case since the inception of trivia I think. Since trivia has evolved quite a bit, what do you think of changing this mechanism? To always directly write the trivia and insert a new line? Does that sound worth exploring?

jindraivanek commented 1 year ago

Hey @nojaf, thanks a lot for quick fix!

IIRC, this logic is there because newline comment can be connected to node that is not the last on line, so we delay its print out to end of line.

My guess is that print out immediately can cause problems (consider for example , on EOL), but definitely it worth a try to see how many test it will break :)

nojaf commented 1 year ago

Thanks, I might give that a shot sometime. Do you want a new release with this fix?

jindraivanek commented 1 year ago

Do you want a new release with this fix? Yes please. Thanks!

nojaf commented 1 year ago

@jindraivanek released https://github.com/fsprojects/fantomas/releases/tag/v6.0.1!