bladnman / auto-align

Visual Studio Code extension to align code blocks
3 stars 3 forks source link

Would like to be able to align by longest operator #2

Open samloeschen opened 5 years ago

samloeschen commented 5 years ago

Hey there, currently a block like this:

{
    int x = 0;
    y += 1;
    int z = 2; 
}

will align to look like this:

{
    int x   = 0;
    y       += 1;
    int z   = 2;
}

and it would be awesome if there was an option to align/indent by the length of the longest operator, so that it would look like this:

{
    int x   = 0;
    y      += 1;
    int z   = 2;
}

I often have blocks with multiple operators and assignments, and would really love to be able to align them all cleanly.

bladnman commented 4 years ago

Sam, that's an interesting idea really. I'd agree that looks and reads better. Maybe I'll get a chance to dive into something like this but I'm pretty preoccupied these days.

I'd love a PR for this. :)

non-bin commented 3 years ago

I think this ties into something I'd like, which is to be able to align multiple things on each line, like a csv file

produces:
kilo  , k,10^3,thousand
hecto , h,10^2,hundred
deca  , da,10^1,ten

should be:
kilo  , k  , 10^3 , thousand
hecto , h  , 10^2 , hundred
deca  , da , 10^1 , ten

I'll have a look at making a PR