-
-
Notifications
You must be signed in to change notification settings - Fork 190
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
Wrong indentation in member definition #844
Comments
Thanks for this report @Bobface, I'll look into this as I'm most likely the one who introduces the bug. |
@nojaf I am already trying to find where the bug is caused. Any tips would be much appreciated! |
Can't really look in detail right now, check the changes of https://github.com/fsprojects/fantomas/pull/818/files |
@Bobface might need unindent after this expression: https://github.com/fsprojects/fantomas/pull/818/files#diff-a1b0b9a30fd94fe61b35a1a52ce27955R2660 |
@nojaf That doesn't fix it unfortunately. |
@nojaf I am assuming the problem might lie here: fantomas/src/Fantomas/CodePrinter.fs Lines 1188 to 1211 in 4c8aeb8
|
@Bobface I found the problem. |
* Don't further indent when member definition is multiline. Fixes #844 * Added extra test for typed member definition. * Remove dumpAndContinue * Add newline at end of file
Issue created from fantomas-online
When a member is created with arguments which exceed the
PageWidth
they get split into separate lines. The body gets indented too much which can result in indentation errors further down. In the example belowSomeOtherMember
is indented one indentation too much. Also an additional newline is added between the=
and the method body - I do not know if this is intended.From my testing it seems like this condition must be met for the error to occur:
The parameters are spread across multiple lines and the body of the method is longer than one line. If we remove the
printfn "a"
in the example below it is formatted correctly. If we remove one of the two parameters the result is also correct no matter the length of the method body.Code
Result
Options
Fantomas Next - 4.0.0-alpha-001-1/1/1990
IndentSpaceNum
4
PageWidth
80
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
KeepIfThenInSameLine
false
StrictMode
false
The text was updated successfully, but these errors were encountered: