aBothe / Mono-D

D Add-In for MonoDevelop
http://wiki.dlang.org/Mono-D
Other
113 stars 26 forks source link

Ugly indentation in at least one provided case #576

Closed CZDanol closed 9 years ago

CZDanol commented 9 years ago

Hey, I think the title is quite self-explanatory :)

Here is the case:

return complexValue(
                        env.calculateIdentifier( "#op+", [
                                env.calculateIdentifier( "#op*", [ a.realPart, b.realPart ], posData ),
                                env.calculateIdentifier( "#op*", [ a.imaginaryPart, b.imaginaryPart ], posData )
                                ], posData ),

                        env.calculateIdentifier( "#op-", [
                                env.calculateIdentifier( "#op*", [ a.imaginaryPart, b.realPart ], posData ),
                                env.calculateIdentifier( "#op*", [ a.realPart, b.imaginaryPart ], posData )
                                ], posData ),
                        );

(It is not indented like that in the ide)

aBothe commented 9 years ago

it's rather like

    return complexValue(
        env.calculateIdentifier( "#op+", [
        env.calculateIdentifier( "#op*", [ a.realPart, b.realPart ], posData ),
        env.calculateIdentifier( "#op*", [ a.imaginaryPart, b.imaginaryPart ], posData )
    ], posData ),

        env.calculateIdentifier( "#op-", [
        env.calculateIdentifier( "#op*", [ a.imaginaryPart, b.realPart ], posData ),
        env.calculateIdentifier( "#op*", [ a.realPart, b.imaginaryPart ], posData )
    ], posData ),
        );

So it's basically ignoring nested (square) brackets and resets the indent on the closing parenthesis' line.

aBothe commented 9 years ago

I've partly solved the problem now. Despite that, I need to know whether it shouldn't be

return complexValue(
                    env.calculateIdentifier( "#op+", [
                                            <tab>env.calculateIdentifier( "#op*", [ a.realPart, b.realPart ], posData ),

instead - just for consistency reasons. So the last line will then include the indent of the first, the second and a further tab caused by the [.

aBothe commented 9 years ago

Best thing: I established an option to disable that nested-call indentation. There still is no gui for it.

    return complexValue(
                        env.calculateIdentifier( "#op+", [
                                                    env.calculateIdentifier( "#op*", [ a.realPart, b.realPart ], posData ),
                                                    env.calculateIdentifier( "#op*", [ a.imaginaryPart, b.imaginaryPart ], posData )
                                                ], posData ),
                        env.calculateIdentifier( "#op-", [
                                                    env.calculateIdentifier( "#op*", [ a.imaginaryPart, b.realPart ], posData ),
                                                    env.calculateIdentifier( "#op*", [ a.realPart, b.imaginaryPart ], posData )
                                                ], posData ),
                        );