0

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.

brian d foy
  • 129,424
  • 31
  • 207
  • 592
Robert
  • 4,324
  • 2
  • 18
  • 22

2 Answers2

4

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.

Robert
  • 4,324
  • 2
  • 18
  • 22
0

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

szabgab
  • 6,202
  • 11
  • 50
  • 64
Christopher Bottoms
  • 11,218
  • 8
  • 50
  • 99