-
Notifications
You must be signed in to change notification settings - Fork 180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Beautify on Save #5
Comments
Would you be happy with this as a mutable set of workspace setting: //beautify all css, js, html on save/close
"beautify.beautifyOnClose": true
// or
"beautify.beautifyOnClose": [
"directory/**/beautify",
"!directory/**/not/beautify",
"!**/*.min.js" ]
// or
"beautify.beautifyOnClose": {
// all css
"css": true,
// matches 'directory/needed/to/beautify' but not 'directory/must/not/beautify'
// and never beautifies .min.js files
"js": [
"directory/**/beautify",
"!directory/**/not/beautify",
"!**/*.min.js" ]
// don't do html (simply leaving this out would do the same)
"html": false
} Using the .gitignore pattern matching (as the VS Code workspace search does). Especially the negation syntax would be useful. I'm not so sure about beautifying on close vs on save. I would expect opening, then closing a file to have no side effect. Having a beautifyOnSave instead would simply require you to hit save, or just enter a space and let the saving (prompted, or auto) do the work. Thoughts? |
I think just a simple beautifyOnSave for the currently focused document would suffice. this is how sublimetext/atom do it and it works well. I would have to be tied to the save function not close however, since I often want to keep the file open after it is formatted. Basically if you can invoke the "HookyQR.beautify" and then save the document when cmd+s / ctrl+s is pressed that would be excellent. |
Added functionality as requested. Published as It won't run if you close a dirty file from the working files list, or if you quit VS Code with a dirty file active. The required trigger function is not called during the save for these processes. |
I love it! Thanks for putting this in so quickly! Question: I use a gulp script for minify files into a public directory. The beautifyOnSave should not affect these correct? In other words, this feature is only activated when you save a file (cmd+s) within the editor window right? |
There is a |
Implemented in 0.1.0 |
I know VS Code does some beautification as text it entered into the editor but a beautify on save feature would be great for files that are opened but not changed. Can this be added to this extension or is it more suited as a feature in the main VSCode app? If it is something easy to add then it would be great to have it in your extension.
The text was updated successfully, but these errors were encountered: