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:
parent
eacf2329da
commit
978a6c5a43
|
@ -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
|
||||||
|
}
|
|
@ -244,6 +244,9 @@ function beautify() {
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (editor.getGrammar().name) {
|
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':
|
case 'JavaScript':
|
||||||
text = beautifyJS(text, getOptions('js', allOptions));
|
text = beautifyJS(text, getOptions('js', allOptions));
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue