Skip Menu |

This queue is for tickets about the Perl-Tidy CPAN distribution.

Report information
The Basics
Id: 119970
Status: resolved
Priority: 0/
Queue: Perl-Tidy

People
Owner: Nobody in particular
Requestors: exodist7 [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: opening token stacking strange behavior
Original: my $x = [ { foo => 1, bar => 1, }, { bat => 1, baz => 1, }, ]; After tidy: my $x = [{ foo => 1, bar => 1, }, { bat => 1, baz => 1, }, ]; Tidy Config: --indent-columns=4 # size of indentation --tabs # use tabs --entab-leading-whitespace=4 # 4 spaces to a tab when converting to tabs --continuation-indentation=4 # indentation of wrapped lines --maximum-line-length=0 # max line length before wrapping (turn it off) --nooutdent-long-quotes # do not outdent overly long quotes --paren-tightness=2 # no spacing for parentheses --square-bracket-tightness=2 # no spacing for square brackets --brace-tightness=2 # no spacing for hash curly braces --block-brace-tightness=0 # spacing for coderef curly braces --comma-arrow-breakpoints=1 # break long key/value pair lists --break-at-old-comma-breakpoints # this attempts to retain list break points --no-blanks-before-comments # do not insert blank lines before comments --indent-spaced-block-comments # no blanks before comments --cuddled-else # } else { appears all on one line --nospace-for-semicolon # no space before semicolons in loops --nospace-terminal-semicolon # no space before termonal semicolons --notrim-qw # don't trim lead/trail whitespace around multi-line qw --blank-lines-before-subs=2 # 2 lines before each sub --opening-token-right # make "push @array, {" indent nicely --stack-opening-tokens # Stack opening tokens: "{ {" instead of "{\n\t{" --stack-closing-tokens # Stack closing tokens: "} }" instead of "\t}\n}" --converge # Run until the output stops changing --extended-syntax # For Fennec/Test2 and other Devel::Declare syntax tools --blank-lines-before-packages=0 # Do not force a newline before a 'package' declaration I want it to stack opening and closing tokens when there is only one nested item, but not when there are more than one: # This is what I want when there is only one nested item my $x = [{ foo => 1, bar => 1, }]; Is there an option I am missing, or can tweak to fix this?
Subject: Re: [rt.cpan.org #119970] opening token stacking strange behavior
Date: Wed, 25 Jan 2017 15:35:24 -0800
To: bug-Perl-Tidy [...] rt.cpan.org
From: Steven Hancock <s7078hancock [...] gmail.com>
Hi Chad, Remove the comma between the closing brace and bracket. Perltidy doesn't remove commas, and can't put the closing tokens together if there is one. perltidy -sot -sct then gives: my $x = [ { foo => 1, bar => 1, } ]; Steve On 1/25/17, Chad Granum via RT <bug-Perl-Tidy@rt.cpan.org> wrote: Show quoted text
> Wed Jan 25 11:32:58 2017: Request 119970 was acted upon. > Transaction: Ticket created by EXODIST > Queue: Perl-Tidy > Subject: opening token stacking strange behavior > Broken in: (no value) > Severity: (no value) > Owner: Nobody > Requestors: exodist7@gmail.com > Status: new > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=119970 > > > > Original: > > my $x = [ > { > foo => 1, > bar => 1, > }, > { > bat => 1, > baz => 1, > }, > ]; > > After tidy: > > my $x = [{ > foo => 1, > bar => 1, > }, > { > bat => 1, > baz => 1, > }, > ]; > > Tidy Config: > --indent-columns=4 # size of indentation > --tabs # use tabs > --entab-leading-whitespace=4 # 4 spaces to a tab when converting to > tabs > --continuation-indentation=4 # indentation of wrapped lines > --maximum-line-length=0 # max line length before wrapping (turn it > off) > --nooutdent-long-quotes # do not outdent overly long quotes > --paren-tightness=2 # no spacing for parentheses > --square-bracket-tightness=2 # no spacing for square brackets > --brace-tightness=2 # no spacing for hash curly braces > --block-brace-tightness=0 # spacing for coderef curly braces > --comma-arrow-breakpoints=1 # break long key/value pair lists > --break-at-old-comma-breakpoints # this attempts to retain list break > points > --no-blanks-before-comments # do not insert blank lines before > comments > --indent-spaced-block-comments # no blanks before comments > --cuddled-else # } else { appears all on one line > --nospace-for-semicolon # no space before semicolons in loops > --nospace-terminal-semicolon # no space before termonal semicolons > --notrim-qw # don't trim lead/trail whitespace around > multi-line qw > --blank-lines-before-subs=2 # 2 lines before each sub > --opening-token-right # make "push @array, {" indent nicely > --stack-opening-tokens # Stack opening tokens: "{ {" instead of > "{\n\t{" > --stack-closing-tokens # Stack closing tokens: "} }" instead of > "\t}\n}" > --converge # Run until the output stops changing > --extended-syntax # For Fennec/Test2 and other Devel::Declare > syntax tools > --blank-lines-before-packages=0 # Do not force a newline before a 'package' > declaration > > > I want it to stack opening and closing tokens when there is only one nested > item, but not when there are more than one: > > # This is what I want when there is only one nested item > my $x = [{ > foo => 1, > bar => 1, > }]; > > Is there an option I am missing, or can tweak to fix this? >
Sorry, I was not clear. I want the end result of tidying to look like this: Show quoted text
> my $x = [ > { > foo => 1, > bar => 1, > }, > { > bat => 1, > baz => 1, > } > ];
when there are multiple hashes in the array. But when there is only one item I want this: Show quoted text
> my $x = [{ > foo => 1, > bar => 1, > }];
I am not sure how to make that happen -Chad On Wed Jan 25 15:35:45 2017, s7078hancock@gmail.com wrote: Show quoted text
> Hi Chad, > Remove the comma between the closing brace and bracket. Perltidy > doesn't remove commas, and can't put the closing tokens together if > there is one. > > perltidy -sot -sct > then gives: > > my $x = [ { > foo => 1, > bar => 1, > } ]; > > > > Steve > > On 1/25/17, Chad Granum via RT <bug-Perl-Tidy@rt.cpan.org> wrote:
> > Wed Jan 25 11:32:58 2017: Request 119970 was acted upon. > > Transaction: Ticket created by EXODIST > > Queue: Perl-Tidy > > Subject: opening token stacking strange behavior > > Broken in: (no value) > > Severity: (no value) > > Owner: Nobody > > Requestors: exodist7@gmail.com > > Status: new > > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=119970 > > > > > > > Original: > > > > my $x = [ > > { > > foo => 1, > > bar => 1, > > }, > > { > > bat => 1, > > baz => 1, > > }, > > ]; > > > > After tidy: > > > > my $x = [{ > > foo => 1, > > bar => 1, > > }, > > { > > bat => 1, > > baz => 1, > > }, > > ]; > > > > Tidy Config: > > --indent-columns=4 # size of indentation > > --tabs # use tabs > > --entab-leading-whitespace=4 # 4 spaces to a tab when converting > > to > > tabs > > --continuation-indentation=4 # indentation of wrapped lines > > --maximum-line-length=0 # max line length before wrapping > > (turn it > > off) > > --nooutdent-long-quotes # do not outdent overly long quotes > > --paren-tightness=2 # no spacing for parentheses > > --square-bracket-tightness=2 # no spacing for square brackets > > --brace-tightness=2 # no spacing for hash curly braces > > --block-brace-tightness=0 # spacing for coderef curly braces > > --comma-arrow-breakpoints=1 # break long key/value pair lists > > --break-at-old-comma-breakpoints # this attempts to retain list break > > points > > --no-blanks-before-comments # do not insert blank lines before > > comments > > --indent-spaced-block-comments # no blanks before comments > > --cuddled-else # } else { appears all on one line > > --nospace-for-semicolon # no space before semicolons in > > loops > > --nospace-terminal-semicolon # no space before termonal > > semicolons > > --notrim-qw # don't trim lead/trail whitespace > > around > > multi-line qw > > --blank-lines-before-subs=2 # 2 lines before each sub > > --opening-token-right # make "push @array, {" indent > > nicely > > --stack-opening-tokens # Stack opening tokens: "{ {" > > instead of > > "{\n\t{" > > --stack-closing-tokens # Stack closing tokens: "} }" > > instead of > > "\t}\n}" > > --converge # Run until the output stops > > changing > > --extended-syntax # For Fennec/Test2 and other > > Devel::Declare > > syntax tools > > --blank-lines-before-packages=0 # Do not force a newline before a > > 'package' > > declaration > > > > > > I want it to stack opening and closing tokens when there is only one > > nested > > item, but not when there are more than one: > > > > # This is what I want when there is only one nested item > > my $x = [{ > > foo => 1, > > bar => 1, > > }]; > > > > Is there an option I am missing, or can tweak to fix this? > >
Subject: Re: [rt.cpan.org #119970] opening token stacking strange behavior
Date: Thu, 26 Jan 2017 08:08:18 -0800
To: bug-Perl-Tidy [...] rt.cpan.org
From: Steven Hancock <s7078hancock [...] gmail.com>
Hi Chad, Oh, I see. No, I don't see a way of doing that. Steve On 1/25/17, Chad Granum via RT <bug-Perl-Tidy@rt.cpan.org> wrote: Show quoted text
> Queue: Perl-Tidy > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=119970 > > > Sorry, I was not clear. > > I want the end result of tidying to look like this: >
>> my $x = [ >> { >> foo => 1, >> bar => 1, >> }, >> { >> bat => 1, >> baz => 1, >> } >> ];
> > when there are multiple hashes in the array. > > But when there is only one item I want this: >
>> my $x = [{ >> foo => 1, >> bar => 1, >> }];
> > I am not sure how to make that happen > > -Chad > > > On Wed Jan 25 15:35:45 2017, s7078hancock@gmail.com wrote:
>> Hi Chad, >> Remove the comma between the closing brace and bracket. Perltidy >> doesn't remove commas, and can't put the closing tokens together if >> there is one. >> >> perltidy -sot -sct >> then gives: >> >> my $x = [ { >> foo => 1, >> bar => 1, >> } ]; >> >> >> >> Steve >> >> On 1/25/17, Chad Granum via RT <bug-Perl-Tidy@rt.cpan.org> wrote:
>> > Wed Jan 25 11:32:58 2017: Request 119970 was acted upon. >> > Transaction: Ticket created by EXODIST >> > Queue: Perl-Tidy >> > Subject: opening token stacking strange behavior >> > Broken in: (no value) >> > Severity: (no value) >> > Owner: Nobody >> > Requestors: exodist7@gmail.com >> > Status: new >> > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=119970 > >> > >> > >> > Original: >> > >> > my $x = [ >> > { >> > foo => 1, >> > bar => 1, >> > }, >> > { >> > bat => 1, >> > baz => 1, >> > }, >> > ]; >> > >> > After tidy: >> > >> > my $x = [{ >> > foo => 1, >> > bar => 1, >> > }, >> > { >> > bat => 1, >> > baz => 1, >> > }, >> > ]; >> > >> > Tidy Config: >> > --indent-columns=4 # size of indentation >> > --tabs # use tabs >> > --entab-leading-whitespace=4 # 4 spaces to a tab when converting >> > to >> > tabs >> > --continuation-indentation=4 # indentation of wrapped lines >> > --maximum-line-length=0 # max line length before wrapping >> > (turn it >> > off) >> > --nooutdent-long-quotes # do not outdent overly long quotes >> > --paren-tightness=2 # no spacing for parentheses >> > --square-bracket-tightness=2 # no spacing for square brackets >> > --brace-tightness=2 # no spacing for hash curly braces >> > --block-brace-tightness=0 # spacing for coderef curly braces >> > --comma-arrow-breakpoints=1 # break long key/value pair lists >> > --break-at-old-comma-breakpoints # this attempts to retain list break >> > points >> > --no-blanks-before-comments # do not insert blank lines before >> > comments >> > --indent-spaced-block-comments # no blanks before comments >> > --cuddled-else # } else { appears all on one line >> > --nospace-for-semicolon # no space before semicolons in >> > loops >> > --nospace-terminal-semicolon # no space before termonal >> > semicolons >> > --notrim-qw # don't trim lead/trail whitespace >> > around >> > multi-line qw >> > --blank-lines-before-subs=2 # 2 lines before each sub >> > --opening-token-right # make "push @array, {" indent >> > nicely >> > --stack-opening-tokens # Stack opening tokens: "{ {" >> > instead of >> > "{\n\t{" >> > --stack-closing-tokens # Stack closing tokens: "} }" >> > instead of >> > "\t}\n}" >> > --converge # Run until the output stops >> > changing >> > --extended-syntax # For Fennec/Test2 and other >> > Devel::Declare >> > syntax tools >> > --blank-lines-before-packages=0 # Do not force a newline before a >> > 'package' >> > declaration >> > >> > >> > I want it to stack opening and closing tokens when there is only one >> > nested >> > item, but not when there are more than one: >> > >> > # This is what I want when there is only one nested item >> > my $x = [{ >> > foo => 1, >> > bar => 1, >> > }]; >> > >> > Is there an option I am missing, or can tweak to fix this? >> >
> > > >
Use the flag -wn (--weld-nested_containers) in version 20180101. Steve