Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(78)

Issue 110079: compact js prettyprint indentation (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
16 years, 7 months ago by felix8a
Modified:
16 years, 6 months ago
Reviewers:
MikeSamuel, ihab.awad
CC:
google-caja-discuss_googlegroups.com
Base URL:
http://google-caja.googlecode.com/svn/trunk/
Visibility:
Public.

Description

Currently, the js prettyprint renderer indents something like this: { ___.loadModule({ 'instantiate': function (___, IMPORTS___) { var $v = ___.readImport(IMPORTS___, '$v', { 'getOuters': { '()': { } } }); } }); } The deep indentation is awkward in several ways, especially when it gets close to the 80-column limit and the prettyprinter ends up emitting 2-3 tokens per line in a skinny far-right column. This change makes the prettyprinter indent like this: { ___.loadModule({ 'instantiate': function (___, IMPORTS___) { var $v = ___.readImport(IMPORTS___, '$v', { 'getOuters': { '()': { } } }); } }); } 1. Each open bracket adds 2 to indent. 2. Continued statements add 2 to indent. This is an example of the difference, output from 'wc': lines words chars 4376 16944 120763 jquery-1.3.2.js 15788 22446 1283779 jquery-1.3.2.out.js (old) 6336 20607 389524 jquery-1.3.2.out.js (new) Using the minifier will be smaller, of course. This change is about improving the debugging experience.

Patch Set 1 #

Total comments: 6

Patch Set 2 : compact js prettyprint indentation #

Unified diffs Side-by-side diffs Delta from patch set Stats (+272 lines, -244 lines) Patch
M src/com/google/caja/render/Indent.java View 1 1 chunk +1 line, -1 line 0 comments Download
M src/com/google/caja/render/Indenter.java View 1 2 chunks +3 lines, -6 lines 0 comments Download
M tests/com/google/caja/demos/applet/caja-applet-cajita-golden.js View 1 1 chunk +27 lines, -27 lines 0 comments Download
M tests/com/google/caja/demos/applet/caja-applet-valija-golden.js View 1 1 chunk +41 lines, -41 lines 0 comments Download
M tests/com/google/caja/opensocial/example-rewritten.xml View 1 1 chunk +73 lines, -70 lines 0 comments Download
M tests/com/google/caja/parser/js/rendergolden2.txt View 1 1 chunk +1 line, -1 line 0 comments Download
M tests/com/google/caja/parser/quasiliteral/testModule.co.js View 1 2 chunks +10 lines, -11 lines 0 comments Download
M tests/com/google/caja/plugin/HtmlEmitterTest.java View 1 3 chunks +3 lines, -3 lines 0 comments Download
M tests/com/google/caja/render/JsPrettyPrinterTest.java View 1 5 chunks +43 lines, -13 lines 0 comments Download
M tests/com/google/caja/render/sbs-golden.js View 1 1 chunk +21 lines, -21 lines 0 comments Download
M tests/com/google/caja/render/ssp-golden.txt View 1 1 chunk +4 lines, -4 lines 0 comments Download
M tests/com/google/caja/service/CajolingServiceTest.java View 1 1 chunk +45 lines, -46 lines 0 comments Download

Messages

Total messages: 6
felix8a
16 years, 7 months ago (2009-08-25 00:59:54 UTC) #1
MikeSamuel
http://codereview.appspot.com/110079/diff/1/7 File tests/com/google/caja/opensocial/example-rewritten.xml (right): http://codereview.appspot.com/110079/diff/1/7#newcode31 Line 31: ; Why is this semi on the next ...
16 years, 7 months ago (2009-09-03 01:52:48 UTC) #2
ihab.awad
http://codereview.appspot.com/110079/diff/1/2 File tests/com/google/caja/render/ssp-golden.txt (right): http://codereview.appspot.com/110079/diff/1/2#newcode7 Line 7: [0,,,] On 2009/09/03 01:52:48, MikeSamuel wrote: > I'm ...
16 years, 7 months ago (2009-09-03 04:20:00 UTC) #3
felix8a
updated snapshot http://codereview.appspot.com/110079/diff/1/7 File tests/com/google/caja/opensocial/example-rewritten.xml (right): http://codereview.appspot.com/110079/diff/1/7#newcode31 Line 31: ; On 2009/09/03 01:52:48, MikeSamuel wrote: ...
16 years, 6 months ago (2009-09-07 01:12:26 UTC) #4
MikeSamuel
LGTM
16 years, 6 months ago (2009-09-09 20:48:38 UTC) #5
felix8a
16 years, 6 months ago (2009-09-09 21:00:02 UTC) #6
@r3715
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b