Another perltidy lazyweb request

mpeters on 2009-06-09T20:37:41

Having been inspired by Domm to fix one of my perltidy annoyances (it says something about the greatness of a tool that I keep using it even though there are some annoyances...).


I have these .perltidyrc settings:

--indent-columns=4
--cuddled-else
--nooutdent-long-quotes
--paren-tightness=2
--brace-tightness=2
--square-bracket-tightness=2


And I have this code:
Some::Class->create(
    {
        foo => 3,
        bar => 2,
        baz => 1,
    }
);


Now I want those opening and closing tokens to be closer together and not waste so much vertical space. So I added this:

--stack-opening-tokens
--stack-closing-tokens


Now my code looks like this:
Some::Class->create({
        foo => 3,
        bar => 2,
        baz => 1,
});


Which is fabulous except that the inner args are indented 2 levels (8 spaces) instead of just 1 (4 spaces). So how do I get this?

Some::Class->create({
    foo => 3,
    bar => 2,
    baz => 1,
});



Me too!

jplindstrom on 2009-06-09T22:21:28

Let me just second that.

I don't think that's configurable since it's a bit of a special case to only want to indent one of the structures.

Unfortunately Perl::Tidy doesn't seem to have any tests to speak of, so it's a bit of an effort to start hacking on it to add missing bits.