4 comments
Avatar
Permanently deleted user

Hi, Ignazio!

Could you provide the code fragment with the desired alignment?
There is a chance that you can reach the result by existing formatting options.
We are trying to support the most common formatting styles.
There are million options, we need to choose the limited set.

Regards,
-uta

0

This an example of code

    int aaa,bbbb,cccccc,ee,ddd,ffffffffff;
    aaa = 42;
    bbbb = 42;
    cccccc = 42;
    ee = 42;
    ddd = 42;
    ffffffffff = 42;


and this is how it looks like after vertical alignment

    int aaa,bbbb,cccccc,ee,ddd,ffffffffff;
    aaa        = 42;
    bbbb       = 42;
    cccccc     = 42;
    ee         = 42;
    ddd        = 42;
    ffffffffff = 42;


Vertical alignemnt is widely used to link lines of code that are strog correlated, like when configure all the properties on one object.
Someone doesn't agree (like "clean-code man" Bob Martin) because with the vertical alignment you add an implict meaning behind the code, and everything that is not code should be maintained as the code. You must to take care of your vertical alignement as well of the comments on your code.

0
Avatar
Permanently deleted user

I got it!

Could you try the checked option "Variable groups|Align in columns" [x]?
That is in Settings|Code Style| C / C++/ Objective-C| Wrapping and Braces dialog.
You can find it fast by using "Find Action" option.

I have

int aaa, bbbb, cccccc, ee, ddd, ffffffffff;

aaa        = 42;
bbbb       = 42;
cccccc     = 42;
ee         = 42;
ddd        = 42;
ffffffffff = 42;


or

int aaa, bbbb, cccccc, ee, ddd, ffffffffff;
    aaa        = 42;
    bbbb       = 42;
    cccccc     = 42;
    ee         = 42;
    ddd        = 42;
    ffffffffff = 42;


depends on empty line presence.

Regards,
-uta

1

it works!
perfect thank you!

just a note: the behaviour of this function is quite different from the "x-align" xcode plugins.

Enabling this option all the variable are (automatically) aligned, even if are not correlated.
With the "x-align" plugin you can force a vertical alignment for small part of your code, but you loose all your vertical alignments if try to indent your code automaticcaly (and it's very bad).

0

Please sign in to leave a comment.