-
-
Notifications
You must be signed in to change notification settings - Fork 194
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
Multiline AbstractSlot without constraints introduces newline #2175
Comments
This took me a minute to spot, but the warning is coming from the addition of another newline in between the definitions of |
Hello Maxime, thank you for reporting this issue. [<Test>]
let ``multiline abstract member without constraints, 2175`` () =
formatSourceString
false
"""
type FuseSortFunctionItem =
abstract Item: key: string -> U2<{| ``$``: string |}, ResizeArray<{| ``$``: string; idx: float |}>> with get, set
abstract X : int
"""
{ config with MaxLineLength = 60 }
|> prepend newline
|> should
equal
"""
type FuseSortFunctionItem =
abstract Item:
key: string ->
U2<{| ``$``: string |}, ResizeArray<{| ``$``: string
idx: float |}>> with get, set
abstract X: int
""" The fantomas/src/Fantomas/CodePrinter.fs Lines 4829 to 4838 in 7373a06
to add a new line. It can be resolved by adding an additional check like: +> onlyIf
(match t with
| TWithGlobalConstraints _ -> true
| _ -> false)
autoIndentAndNlnIfExpressionExceedsPageWidth
(genConstraints astContext t vi) Are you interested in submitting a PR for this? |
Hello @nojaf, thank you for the clear explanations.
I don't think I will have the time to look into the issue as I have a lot of stuff on my side to handle already. And learning about Fantomas internal, will probably takes me some times ^^ sorry. |
When trying to format some code using Fantomas I got an Idempotency warning.
I was able to narrow it to these code:
The code can looks strange but that's because it is a Fable binding
Issue created from fantomas-online
Formatted code
Reformatted code
Problem description
Fantomas was not able to produce the same code after reformatting the result.
Extra information
Options
Fantomas master branch at 2022-03-29T09:12:14Z - 8f2ab14
Did you know that you can ignore files when formatting from fantomas-tool or the FAKE targets by using a .fantomasignore file?
The text was updated successfully, but these errors were encountered: