-
-
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
Return attribute deleted on reformatting #800
Comments
Hello, this is an AST bug. The attributes of the return type are stored in SynBinding -> SynValInfo -> SynArgInfo -> SynAttributes. So the LetBinding active pattern should be extended to also capture the synValData. And then the attributes can be generated in genLetBinding. The attributes themselves can be printed with genAttributes. Could I persuade you to tackle this issue yourself? |
@nojaf From what I could tell, the +> leadingExpressionIsMultiline
(afterLetKeyword +> genPat +> enterNodeTokenByName rangeBetweenBindingPatternAndExpression "EQUALS")
(genExprSepEqPrependType astContext p e) and in turn in: (addExtraSpaceBeforeGenericType
+> genCommentBeforeColon
+> sepColon
+> genType astContext false t since this is called from a number of places, I tried introducing an option valInfo in there: and pass it from let genMetadataAttributes ctx =
match valInfo with
| Some(SynValInfo(_, SynArgInfo(attributes, _, _))) -> genAttributes astContext attributes ctx
| None -> sepNone ctx and (addExtraSpaceBeforeGenericType
+> genCommentBeforeColon
+> sepColon
+> genMetadataAttributes
+> genType astContext false t when formatting let f x: [<``return``:MyCustomAttributeThatWorksOnReturns>]
int = x note the extra new line and the return in quotes, am I on the right path here ? |
I think you are on the right track but again this is hard to read. |
That looks proimising - now we have to fix the back-tcks on the reserved
word return
…On Sat, 16 May 2020 at 10:08, Florian Verdonck ***@***.***> wrote:
I think you are on the right track but again this is hard to read.
It is really encouraged to make a (draft) PR, by correct linking you are
letting other people know that you are working on this. As for the extra
`` I think I know where those are coming from.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#800 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAFJ5S3GVBH4VCQRTJLFH4TRRZJZJANCNFSM4MXCE4XQ>
.
|
Issue created from fantomas-online
Please describe here fantomas problem you encountered
Fantomas has deleted the return attribute - this breaks the code
Code
Result
Options
Fantomas Next - 4.0.0-alpha-001-1/1/1990
IndentSpaceNum
4
PageWidth
120
SemicolonAtEndOfLine
false
SpaceBeforeParameter
true
SpaceBeforeLowercaseInvocation
true
SpaceBeforeUppercaseInvocation
false
SpaceBeforeClassConstructor
false
SpaceBeforeMember
false
SpaceBeforeColon
false
SpaceAfterComma
true
SpaceBeforeSemicolon
false
SpaceAfterSemicolon
true
IndentOnTryWith
false
SpaceAroundDelimiter
true
MaxIfThenElseShortWidth
40
MaxInfixOperatorExpression
50
MaxRecordWidth
40
MaxArrayOrListWidth
40
MaxLetBindingWidth
40
MultilineBlockBracketsOnSameColumn
false
NewlineBetweenTypeDefinitionAndMembers
false
StrictMode
false
The text was updated successfully, but these errors were encountered: