如何防止PerlTidy对齐分配但继续添加单个空格?
这个问题与How can I prevent PerlTidy from aligning my assignments?类似,但我希望在指示的地方添加单个空格。由于此-naws
开关对我不起作用。我只是不想插入多个空格。可能与perltidy或其他工具有关吗?
Perl整洁的变化:
my $a = 1;
my $aa = 2;
my $aaa= 3;
到
my $a = 1;
my $aa = 2;
my $aaa = 3;
与-naws保持不变:
my $a = 1;
my $aa = 2;
my $aaa= 3;
我希望将此代码格式化为:
my $a = 1;
my $aa = 2;
my $aaa = 3;
答案 0 :(得分:3)
以下补丁对我有用:
--- Tidy.pm.org 2009-06-16 22:00:50.000000000 +0200
+++ Tidy.pm 2010-12-28 09:43:19.625000000 +0100
@@ -12404,7 +12404,7 @@
# accept vertical alignment.
# nothing to do if we aren't allowed to change whitespace
- if ( !$rOpts_add_whitespace ) {
+ if ( 1 || !$rOpts_add_whitespace ) {
for my $i ( 0 .. $max_index_to_go ) {
$matching_token_to_go[$i] = '';
}