Closed artemiipatov closed 2 months ago
Hello, thank you for your interest in this project! Tuple bindings are covered a bit differently due to historical reasons. Which is why the return type is missing.
I believe the problem is centered around: https://github.com/fsprojects/fantomas/blob/0ce91b778f216c2d7fa8286d1aa4aa5dbf835bcc/src/Fantomas.Core/CodePrinter.fs#L2866-L2867
There we could do something like:
let genDestructedTuples =
expressionFitsOnRestOfLine (genPat pat) (sepOpenT +> genPat pat +> sepCloseT)
+> optSingle
(fun (rt: BindingReturnInfoNode) ->
genSingleTextNode rt.Colon
+> sepSpace
+> atCurrentColumnIndent (genType rt.Type))
b.ReturnType
to print the return type when it is present.
I'm not sure how well this exact fix would play when the tuple is multiline. Something like
let a, //
b, //
c
: int * int * int = 1,2,3
Might be a corner case.
Are you interested in submitting a PR for this one?
Issue created from fantomas-online
Code
Result
Problem description
Fantomas removes type annotation without brackets. But when brackets are placed around names, annotations are not removed.
Extra information
Options
Fantomas main branch at 1/1/1990
Default Fantomas configuration
Did you know that you can ignore files when formatting by using a .fantomasignore file? PS: It's unlikely that someone else will solve your specific issue, as it's something that you have a personal stake in.