开发者

How can perltidy align the opening parenthesis for method arguments?

is there 开发者_开发技巧a possibility to make perltidy vertically align brackets like this:

$foo->bar                                (1);
$foo->bat                                (2);
$foo->bac                                (3);
$foo->bad                                (4);
$foo->bae                                (5);
$foo->baf                                (6);
$foo->bagofbones                         (7);
$foo-> what_a_strange_name_for_a_message ('but it must be so');

best, R.


I have found it. In my .perltidyrc i had the --space-function-paren Option set.

$  perltidy --noprofile --space-function-paren <<EOF
> \$foo->bar (1);
> \$foo->bat (2);
> \$foo->bac (3);
> \$foo->bad (4);
> \$foo->bae (5);
> \$foo->baf (6);
> \$foo->bagofbones (7);
> \$foo-> what_a_strange_name_for_a_message ('but it must be so');
> EOF
$foo->bar                               (1);
$foo->bat                               (2);
$foo->bac                               (3);
$foo->bad                               (4);
$foo->bae                               (5);
$foo->baf                               (6);
$foo->bagofbones                        (7);
$foo->what_a_strange_name_for_a_message ('but it must be so');

Unfortunately i haven't found anything in perltidy's manual about vertical alignment while using -sfp, but i can live without it.

Thank you for help.


This is not a global answer, but if you have blocks of code that you don't want reformatted, use #<<< to start a section to ignore and #>>> to end the section to ignore:

#<<<  do not let perltidy touch this
    my @list = (1,
                1, 1,
                1, 2, 1,
                1, 3, 3, 1,
                1, 4, 6, 4, 1,);
#>>>

from https://metacpan.org/pod/distribution/Perl-Tidy/bin/perltidy

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜