Configuring JSBeautify?


Does anyone know how to configure the JS Beautify that C9 uses?

I’m aware that is being used, since the ignore and preserve directives do work, and have tried creating a .jsbeautifyrc in several directories (project root, and one up)

I’m working with React and ES6, so the auto-formatting is proving to be a pain with ES6 bracketed imports re-organising onto new lines. I can see that I need to use the collapse-preserve-inline option for brackets, but no idea how/where to configure this. Only collapse and inline appear under the default options.



If you open your preferences window and go to user settings there will be a link to the user.settings file. When you click on it, a json file will be opened. In there, there is a jbeautify section. It has an @advance section that allows you to specify all options you need to customize that are not supported through the normal ui preferences.

Here is the snippet from mine where I am doing exactly what you are referencing…

"format": { "jsbeautify": { "@advanced": { "brace_style": "collapse-preserve-inline" }, "@braces": "collapse", "@indent_inner_html": false, "@jslinthappy": false, "@keeparrayindentation": false, "@preserveempty": true, "@space_before_conditional": true, "@unescape_strings": true } }


That did the trick! Thanks so much, it’s been driving me crazy.

I had the line in there, except named brace-style :open_mouth: