Document Information

Last modified:
2011/02/22 12:31 (external edit)

This is documentation for qooxdoo 0.7.x only. You might be interested in consulting the latest docs.

Code Style

Pretty Printer

This is some information about the possible configuration of pretty printing in release 0.7.

Pretty printing existing JavaScript class files (no migration to 0.7). In the following example, my/cool/Class.js is replaced by the pretty-printed version:

$ cd framework
$ tool/generator.py --pretty-print --include-without-dependencies my.cool.Class \
  --class-path source/class --cache-directory .cache/

If you use the –pretty-print switch to enable code beautification in general, there are a couple of additional options available that help you to tailor the resulting code style to your needs. These additional options only work if –pretty-print is enabled. You can get a complete list of these options if you invoke the generator with generator.py –help and scan for "pretty". Currently, the following options are available:

--pretty-print-indent-string=STRING

String used for indenting. Popular choices would be " " (2 spaces), or " " (4 spaces). Within the indentation string the escaped character "\t" (backslash-t) is available to indicate the TAB character. Combinations are possible (even if the resulting code looks weird ;), the default is " " (2 spaces).

--pretty-print-newline-before-open-curly=[aAnNmM]

Defines whether "{" will always [aA] or never [nN] be on a new line. This covers all occurences of "{", be it functions, loop bodies or maps. The default is mixed behaviour [mM], which leaves opening curly braces on the same or puts them on a new line, depending on the complexity of the contained code block.

--pretty-print-indent-before-open-curly

This flag causes the indent string to always be inserted before an opening curly brace, "{" (default: False).

--pretty-print-indent-align-block-with-curlies

Align a block of code with its surrounding curlies (obviously not with the opening curly when it is not on a new line); use in combination with –pretty-print-indent-before-open-curly, otherwise the result might look weird (default: False)

--pretty-print-comments-trailing-keepColumn

Keep column for trailing comments instead of just putting it after text (via pretty-print-inline-comment-padding). If code is too long, either the padding specified in –pretty-print-inline-comment-padding is inserted or the comment is moved to the next column given by –pretty-print-comments-trailing-commentCols (default: False)

--pretty-print-comments-trailing-commentCols=STRING

Columns for trailing comments as a comma separated list e.g. "50,70,90". In this case if code length is less than 49, column 50 will be used; if between 50 and 69, column 70 will be used and so on. These apply if –pretty-print-comments-trailing-keepColumn isn't specified, or if it is specified but the code exceeds the original column (default: "")

--pretty-print-inline-comment-padding=STRING

Allows you to specify a string used between the end of a statement and a trailing inline comment (default: " " (2 spaces)).

Information

Last modified:
2011/02/22 12:31 (external edit)

Account

 
 
A book on qooxdoo RIAs, authored  by community members
JS Tutorial, JavaScript Tutorial, JavaScript Guide, Learn JavaScript JS, How To Learn JS, Learning JavaScript
 

Bad Behavior has blocked 0 potential spam attempts in the last 7 days.