Closed Bug 1809941 Opened 5 months ago Closed 2 months ago

In some case pretty-printing still produces long lines

Categories

(DevTools :: Debugger, defect, P2)

defect

Tracking

(firefox114 verified)

VERIFIED FIXED
114 Branch
Tracking Status
firefox114 --- verified

People

(Reporter: nchevobbe, Assigned: nchevobbe)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Steps to reproduce

  1. Go to https://ffx-devtools-pretty-print.glitch.me/
  2. Open the debugger
  3. Select the cases/long-lines.js file
  4. Click the Pretty print icon

Expected results

Those long lines gets chopped-up into multiple, smaller ones

Actual results

The lines are still long after pretty printing


It looks like we could do a better job when expressions are separated by && or || (especially when we're not in a if condition)
We could also have better output for ternary conditions

Priority: -- → P2
Severity: -- → S3

When dealing with a ( token, we check the next tokens to find the matching
closing paren. In the same time, we compute the length of all the tokens inside
the paren.
If we reach a given length (60 at the moment) without finding the closing paren,
we consider it "long" and will treat it (and the closing paren) as line delimiter.
On top of that, we expand line delimiters to || and && when there not in a
"short" paren, so we can split up long lines.

Pushed by nchevobbe@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/a9f77a7cf26b
[devtools] Add line break after parens when content is long. r=devtools-reviewers,bomsy.
Flags: needinfo?(nchevobbe)

ah sorry, i thought I fixed it at some point 🤔

Flags: needinfo?(nchevobbe)
Pushed by nchevobbe@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/62af6f051232
[devtools] Add line break after parens when content is long. r=devtools-reviewers,bomsy.
Status: ASSIGNED → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → 114 Branch
Flags: qe-verify+

I've reproduced this issue using Nightly 114.0a1 (2023-04-15) on Windows 10 x64 following the STR from Comment 0.
Verified as fixed on the latest Firefox 114.0b3 version on Windows 10, macOS 13 and Ubuntu 22.04, where the issue no longer persists.

Status: RESOLVED → VERIFIED
Flags: qe-verify+
You need to log in before you can comment on or make changes to this bug.