Autoformat doesn't work on icloud.com (javascript-packed.js) Steps to Reproduce: 1. Inspect iCloud.com 2. Open javascript-packed.js => Doesn't auto-format Notes: • The file starts out with: 7300+ characters that are unminified license / header doc characters. This causes our isTextLikelyMinified to fail.
<rdar://problem/42546126>
Created attachment 357851 [details] [PATCH] Proposed Fix I still think the best solution might be to auto format if any line is longer than 250 characters, or something like that. But a start/end check of 2500 characters seems reasonable. We can bring that back to 5000 if there is a counterexample.
Comment on attachment 357851 [details] [PATCH] Proposed Fix View in context: https://bugs.webkit.org/attachment.cgi?id=357851&action=review rs=me, nice test > LayoutTests/inspector/formatting/is-text-likely-minified.html:111 > + let sampleHeader = ` NIT: const. > LayoutTests/inspector/formatting/is-text-likely-minified.html:127 > + let longHeaderSource = sampleHeader.repeat(10) + jQueryMinifiedSourceFragment; NIT: const. > LayoutTests/inspector/formatting/is-text-likely-minified.html:129 > + name: "JQuerySnippet.Minified", Use a different name, like "JQuerySnippet.MinifiedWithHeader". NIT: jQuery is stylized as "jQuery" not "JQuery", so we might want to follow that. > Source/WebInspectorUI/UserInterface/Base/Utilities.js:1621 > + for (let i = start; i < end; i++) { NIT: ++i > Source/WebInspectorUI/UserInterface/Base/Utilities.js:1623 > if (char === " ") Should we care about \r as well?
> > Source/WebInspectorUI/UserInterface/Base/Utilities.js:1623 > > if (char === " ") > > Should we care about \r as well? Interesting. Yes probably but it is very rare to have only \r line endings.
https://trac.webkit.org/r239467