Skip to content

Commit

Permalink
See #14. Add JSON support.
Browse files Browse the repository at this point in the history
JSON is processed as if it were JavaScript.
I have tested it (see examples/simple-jsbeautifyrc/test.json)
and it works as expected and supports comments!
  • Loading branch information
Glavin001 committed Jun 14, 2014
1 parent eacf232 commit 978a6c5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
9 changes: 9 additions & 0 deletions examples/simple-jsbeautifyrc/test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"indent_size": 2,
"indent_char": " ", // test
"indent_level": 0,
"indent_with_tabs": false, /* test */
"preserve_newlines": true,
"max_preserve_newlines": 2, /* test *
"jslint_happy": true
}
3 changes: 3 additions & 0 deletions lib/atom-beautify.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,9 @@ function beautify() {
}

switch (editor.getGrammar().name) {
case 'JSON':
// Treat JSON as JavaScript, because it will support comments.
// And Glavin001 has tested JSON beauifying with beautifyJS.
case 'JavaScript':
text = beautifyJS(text, getOptions('js', allOptions));
break;
Expand Down

0 comments on commit 978a6c5

Please sign in to comment.