See #14. Add JSON support.

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!
This commit is contained in:
Glavin Wiechert 2014-06-14 00:59:19 -03:00
parent eacf2329da
commit 978a6c5a43
2 changed files with 12 additions and 0 deletions

View File

@ -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
}

View File

@ -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;