formatOnSave not using `.jsbeautifyrc`
See original GitHub issueOperating System (+Version): Mac 10.11.6 VS Code Version: 1.11.2 beautify Version: 1.0.2
Issue: I would like to use vscode’s built in formatOnSave hook to trigger the beautify extension’s reformatting of .js
, .css
, and .html
files. While running beautify from the command palette works fine, formatOnSave falls back to vscode formatting config and not my .jsbeautifyrc
.
VSCode:
{
"editor.formatOnSave": true
, "beautify.config": "~/.jsbeautifyrc"
}
I’ve also tried using an absolute path for beautify.confg
.
~/.jsbeautifyrc
{
"end_with_newline": true
, "indent_char": " "
, "indent_size": 4
, "indent_with_tabs": false
, "max_preserve_newlines": 2
, "wrap_line_length": 120
, "indent_body_inner_html": false
, "indent_scripts": "normal"
, "wrap_attributes": "force-aligned"
, "newline_between_rules": false
, "break_chained_methods": false
, "comma_first": true
, "keep_array_indentation": false
, "keep_function_indentation": false
, "operator_position": "after-newline"
, "space_before_conditional": true
, "space_in_paren": true
, "space_in_empty_paren": false
}
Action performed
Save file
Expected results
Expect the above formatting config to be respected.
Actual results
Plain vscode formatting applied. Obvious differences from config include chained method call line breaks, no spaces in function parens
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:6 (2 by maintainers)
Top Results From Across the Web
VS Code reverting js-beautify code formatting on save
I submitted an issue on the github repo. You can follow it at formatOnSave not using .jsbeautifyrc #133 Maybe post your settings for...
Read more >Prettier + Format On Save = Never worry about ... - Scott Sauber
In my last post, I mentioned a tip to using the Format on Save option in VS ... I love about it is...
Read more >Beautify - Visual Studio Marketplace
For help on the settings in the .jsbeautifyrc see Settings.md ... When not using a multi-root workspace: ... formatOnSave" is true.
Read more >Formatting In Visual Studio Code: EditorConfig And js-beautify
I dont want to write my own formatter, so I use js-beautify for this. ... If there is a valid .jsbeautifyrc in the...
Read more >HTML-CSS-JS Prettify - Package Control
This will work with either HTML, CSS, JavaScript, JSON, React and Vue files. ... To stop using the formatting style defined in the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hey @alexsasharegan and @wbuck, I’ve been away for a while. Taking a look now. Seems like it’s a VS Code issue. There’s no difference in the extension code on how it handles regular formatting and format on save. I may have missed an API change, or they could have broken the formatter lookup order.
Hold tight. I’m on it.
Thanks for looking in to it. I had a feeling it was a VS Code issue.