Commit Graph

121 Commits

Author SHA1 Message Date
Liam Newman
14e4edc069 Comments between } and else should prevent collapsing
Closes #206
2013-03-27 09:44:42 -07:00
Liam Newman
d5ec851f11 Preserve newlines on either side of ++ and --
This closes #56 and openes the new less severe case of #203.
2013-03-25 00:08:19 -07:00
Liam Newman
978273aeba Fix preserved newlines inside expression frames 2013-03-21 12:30:30 -07:00
Liam Newman
9dbaacc778 Re-indent js tests 2013-03-21 00:13:45 -07:00
Liam Newman
76612f49b7 Add tests for #197 2013-03-21 00:13:45 -07:00
Liam Newman
5000464bf0 Separate the node aspects of test from browser runnable ones 2013-03-21 00:13:44 -07:00
Liam Newman
f3fd73a2dc Make array indents more conistent with other block indents
Closes #17
2013-03-18 10:21:55 -07:00
Liam Newman
eeece7b375 Make statements inside expresions close when the parent closes
This is not valid syntax but we still want to degrade gracefully.

Closes #186 (even more firmly)
2013-03-16 20:49:42 -07:00
Liam Newman
6206c3cf78 Make statements inside blocks close when the parent block closes
Closes #186
2013-03-16 18:11:39 -07:00
Liam Newman
f2b65aaed1 Sync python with the js new sweetness
Closes #185
2013-03-15 17:36:36 -07:00
Liam Newman
2180f46258 Add bare if-for test
Closes issue #108
2013-03-15 02:46:31 -07:00
Liam Newman
23a6428eef Fix mis-indenting in untainted var lines
Fixes issue #184.
2013-03-15 02:27:32 -07:00
Liam Newman
646308b165 Reduce the cases where output needs trimming by indenting tokens when printed. 2013-03-14 17:38:05 -07:00
Liam Newman
d1a59c77ad Tweaks statement indent unwinding to handle nested bare if and else 2013-03-14 17:38:05 -07:00
Liam Newman
85bc046c33 Make parsing of bare if/for/while/do consitent and beautifiable. 2013-03-14 17:38:05 -07:00
Liam Newman
429271f43f Enable configurable line wrapping
Wrapping is approximat and occurs at the same locations
where newlines would be preserved.
2013-03-12 15:27:34 -07:00
Liam Newman
4ad4d27cf4 Allow preserved newlines on dots 2013-03-12 12:02:18 -07:00
Liam Newman
bfa04e4595 Add newline preservation on open-paren.
a = b &&
    (c || d);
2013-03-12 10:33:56 -07:00
Liam Newman
849787ea11 Allow words to also be locations for preserved newlines.
Poor-man's word-wrap for long lines.
2013-03-11 16:19:00 -07:00
Liam Newman
3fd3b379a2 Universal handling of inline comments (by skipping them).
Fix string getting indented at start of file.
2013-02-28 14:06:29 -08:00
Liam Newman
25e7c4f929 Fix inline comments breaking meaning of return 2013-02-27 12:47:07 -08:00
Einar Lielmanis
a3a091c8c1 Fix #175 regression, js freeze on incomplete strings 2013-02-13 22:03:38 +02:00
Einar Lielmanis
b91e6cd324 Improved unescape when opt.unescape_strings = true
1. javascript version only,

2. the command-line javascript engines seem to bork the encoding in
   tests, even with utf-8 locale, meanwhile the in-browser tests pass.
   Weird.
2013-01-21 18:55:13 +02:00
Einar Lielmanis
8daa7c7b27 Fix strings starting after a comment (+fix #167) 2012-12-27 12:57:07 +02:00
Einar Lielmanis
8ceee0d082 Make beautifer strict-safe, fixes #166 2012-12-23 12:40:50 +02:00
Daniel Stockman
cf49a91dd2 Fix running tests with node. 2012-12-05 11:28:11 -08:00
Einar Lielmanis
3b96d09435 Fix 161, unneeded indents inside object definition
var a = {
        'b': 1,
        'c': 2,
        'd': 3,
        'e': 4
    };

becomes

    var a = {
        'b': 1,
            'c': 2,
            'd': 3,
            'e': 4
    };

Doesn't happen when "Preserve empty lines" is unchecked or properties
are not wrapped in quotes.
2012-12-01 15:15:01 +02:00
Einar Lielmanis
f74872723f Fix #159, negative numbers in lists 2012-11-11 02:51:30 +02:00
Einar Lielmanis
ce35bad1d5 simplify keep_array_indentation, fix #155 2012-11-05 08:41:10 +02:00
Einar Lielmanis
de159f4406 Preserve_newlines honors multiline string concatenation (fix #154) 2012-11-05 07:44:35 +02:00
Einar Lielmanis
b20be9495b Drop Crockford's switch indentation (#15) 2012-10-12 01:21:34 +03:00
Einar Lielmanis
595d8125a3 Improve chained methods (fix #151, ref #93, #10)
Implement a new option, break_chained_methods:

  False(default): leave the chained methods intact, i.e

      a().b() -> a().b()

      a()     -> a()
        .b()      .b()

  True: always break chained methods with a newline.

      a().b() -> a()
                  .b()

      a()     -> a()
        .b()      .b()

Add a checkbox to turn the feature on/off to the frontpage.
2012-10-05 03:03:51 +03:00
Einar Lielmanis
ae46e5a915 Fix some problems with the chained methods
this.model = new Backbone.Model();

turned into

this.model = new Backbone
                .Model();
2012-09-26 02:46:58 +03:00
Einar Lielmanis
a6688c33b6 Treat chained statements nicely (fix #93, close #10) 2012-09-24 20:13:27 +03:00
Einar Lielmanis
2b3b0fe526 Do not break the comment in the middle of if-line
if (bug) //here comes comment
  importantLine();

Was formatted into:

if (bug) //here comes commentimportantLine();

Now it is

if (bug) //here comes comment
importantLine();

Which, while incorrectly indented, at least doesn't break the scripts.
2012-07-24 15:22:13 +03:00
Einar Lielmanis
971a7b9457 Fix #135, "+" detection in bookmarklets 2012-07-22 11:57:41 +03:00
Einar Lielmanis
57ad392ed2 Fix #134, a regex-as-parameter regression 2012-07-20 22:07:40 +03:00
Einar Lielmanis
b147439fa2 Update py and tests with fmgdias changes 2012-07-20 18:51:24 +03:00
Einar Lielmanis
d7b2903c6f Fix #130, more function-cases not covered by tests 2012-07-18 11:46:07 +03:00
Einar Lielmanis
b8726ebdce Fix #120, whitespace regressions for "function" 2012-07-17 21:19:20 +03:00
Einar Lielmanis
c6c645fe97 Remove node hashbang, it borks by tests 2012-07-17 15:47:23 +03:00
Daniel Stockman
2d21c3557a Enable easy local testing with node.
* Add node shebang to beautify-tests.js
* Add module.exports detection and population to sanitytest.js
* Ensure js_beautify and SanityTest variables are required when necessary.
2012-07-12 15:51:25 -07:00
Daniel Stockman
1a3c1f43db jshint tests/* 2012-07-12 14:55:09 -07:00
Einar Lielmanis
29fffc280e Extract TK_COMMA from TK_OPERATOR, fix #125 2012-07-05 18:34:35 +03:00
Einar Lielmanis
c787620fc3 Fix #123 a terrible regresion with "return function" 2012-06-27 21:28:20 +03:00
Einar Lielmanis
692b3189f0 Fix #44, inline comments get put on following line 2012-06-26 16:15:16 +03:00
Einar Lielmanis
3127744932 Get the spacing for comments right (fixes #122) 2012-06-26 16:04:37 +03:00
VittGam
2583e28ccc Added ability to unescape \uNNNN printable characters. 2012-06-24 23:50:38 +02:00
VittGam
569e558bdd s/decode_characters/unescape_strings/ 2012-06-24 23:36:09 +02:00
VittGam
882378cb3b Added how to run the JS tests with nodejs as a comment in the run-tests file. 2012-06-24 23:31:15 +02:00