Is it possible to exclude some file extensions in “format on save” in visual studio code?
up vote
36
down vote
favorite
Currently in VSCode settings you can configure format on save as following:
"editor.formatOnSave": true
I want to exclude some files, for example only format the JavaScript files but not format the HTML files, or at least is there some plugin to accomplish that?
visual-studio-code vscode-settings
add a comment |
up vote
36
down vote
favorite
Currently in VSCode settings you can configure format on save as following:
"editor.formatOnSave": true
I want to exclude some files, for example only format the JavaScript files but not format the HTML files, or at least is there some plugin to accomplish that?
visual-studio-code vscode-settings
add a comment |
up vote
36
down vote
favorite
up vote
36
down vote
favorite
Currently in VSCode settings you can configure format on save as following:
"editor.formatOnSave": true
I want to exclude some files, for example only format the JavaScript files but not format the HTML files, or at least is there some plugin to accomplish that?
visual-studio-code vscode-settings
Currently in VSCode settings you can configure format on save as following:
"editor.formatOnSave": true
I want to exclude some files, for example only format the JavaScript files but not format the HTML files, or at least is there some plugin to accomplish that?
visual-studio-code vscode-settings
visual-studio-code vscode-settings
edited May 20 at 7:24
Gama11
10.6k21843
10.6k21843
asked Jun 29 '17 at 17:14
gabrielAnzaldo
4612915
4612915
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
71
down vote
accepted
You can use language specific settings to enable it for a specific language only, e.g. JavaScript:
"[javascript]": {
"editor.formatOnSave": true
}
To disable it for a specific language, you could switch the global default to true and combine it with a language-specific false:
"editor.formatOnSave": true
"[javascript]": {
"editor.formatOnSave": false
}
Thanks to Tobi for pointing this trick out in the comments.
thanks, works like a charm!
– gabrielAnzaldo
Jun 29 '17 at 20:48
18
FWIW, this also works the other way around to exclude only certain types from getting formatted:{ "editor.formatOnSave": true, "[handlebars]": { "editor.formatOnSave": false }}
– Tobi Kremer
Aug 21 '17 at 9:18
Thanks for the handlebars snippet.
– KevinOrfas
Sep 20 '17 at 13:51
Very handy. Any chance it's possible to exclude folders?
– slashwhatever
Mar 22 at 9:27
What about.files such as.babelrc?
– fencepencil
Jul 25 at 13:37
|
show 3 more comments
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
71
down vote
accepted
You can use language specific settings to enable it for a specific language only, e.g. JavaScript:
"[javascript]": {
"editor.formatOnSave": true
}
To disable it for a specific language, you could switch the global default to true and combine it with a language-specific false:
"editor.formatOnSave": true
"[javascript]": {
"editor.formatOnSave": false
}
Thanks to Tobi for pointing this trick out in the comments.
thanks, works like a charm!
– gabrielAnzaldo
Jun 29 '17 at 20:48
18
FWIW, this also works the other way around to exclude only certain types from getting formatted:{ "editor.formatOnSave": true, "[handlebars]": { "editor.formatOnSave": false }}
– Tobi Kremer
Aug 21 '17 at 9:18
Thanks for the handlebars snippet.
– KevinOrfas
Sep 20 '17 at 13:51
Very handy. Any chance it's possible to exclude folders?
– slashwhatever
Mar 22 at 9:27
What about.files such as.babelrc?
– fencepencil
Jul 25 at 13:37
|
show 3 more comments
up vote
71
down vote
accepted
You can use language specific settings to enable it for a specific language only, e.g. JavaScript:
"[javascript]": {
"editor.formatOnSave": true
}
To disable it for a specific language, you could switch the global default to true and combine it with a language-specific false:
"editor.formatOnSave": true
"[javascript]": {
"editor.formatOnSave": false
}
Thanks to Tobi for pointing this trick out in the comments.
thanks, works like a charm!
– gabrielAnzaldo
Jun 29 '17 at 20:48
18
FWIW, this also works the other way around to exclude only certain types from getting formatted:{ "editor.formatOnSave": true, "[handlebars]": { "editor.formatOnSave": false }}
– Tobi Kremer
Aug 21 '17 at 9:18
Thanks for the handlebars snippet.
– KevinOrfas
Sep 20 '17 at 13:51
Very handy. Any chance it's possible to exclude folders?
– slashwhatever
Mar 22 at 9:27
What about.files such as.babelrc?
– fencepencil
Jul 25 at 13:37
|
show 3 more comments
up vote
71
down vote
accepted
up vote
71
down vote
accepted
You can use language specific settings to enable it for a specific language only, e.g. JavaScript:
"[javascript]": {
"editor.formatOnSave": true
}
To disable it for a specific language, you could switch the global default to true and combine it with a language-specific false:
"editor.formatOnSave": true
"[javascript]": {
"editor.formatOnSave": false
}
Thanks to Tobi for pointing this trick out in the comments.
You can use language specific settings to enable it for a specific language only, e.g. JavaScript:
"[javascript]": {
"editor.formatOnSave": true
}
To disable it for a specific language, you could switch the global default to true and combine it with a language-specific false:
"editor.formatOnSave": true
"[javascript]": {
"editor.formatOnSave": false
}
Thanks to Tobi for pointing this trick out in the comments.
edited Apr 12 at 10:40
answered Jun 29 '17 at 17:34
Gama11
10.6k21843
10.6k21843
thanks, works like a charm!
– gabrielAnzaldo
Jun 29 '17 at 20:48
18
FWIW, this also works the other way around to exclude only certain types from getting formatted:{ "editor.formatOnSave": true, "[handlebars]": { "editor.formatOnSave": false }}
– Tobi Kremer
Aug 21 '17 at 9:18
Thanks for the handlebars snippet.
– KevinOrfas
Sep 20 '17 at 13:51
Very handy. Any chance it's possible to exclude folders?
– slashwhatever
Mar 22 at 9:27
What about.files such as.babelrc?
– fencepencil
Jul 25 at 13:37
|
show 3 more comments
thanks, works like a charm!
– gabrielAnzaldo
Jun 29 '17 at 20:48
18
FWIW, this also works the other way around to exclude only certain types from getting formatted:{ "editor.formatOnSave": true, "[handlebars]": { "editor.formatOnSave": false }}
– Tobi Kremer
Aug 21 '17 at 9:18
Thanks for the handlebars snippet.
– KevinOrfas
Sep 20 '17 at 13:51
Very handy. Any chance it's possible to exclude folders?
– slashwhatever
Mar 22 at 9:27
What about.files such as.babelrc?
– fencepencil
Jul 25 at 13:37
thanks, works like a charm!
– gabrielAnzaldo
Jun 29 '17 at 20:48
thanks, works like a charm!
– gabrielAnzaldo
Jun 29 '17 at 20:48
18
18
FWIW, this also works the other way around to exclude only certain types from getting formatted:
{ "editor.formatOnSave": true, "[handlebars]": { "editor.formatOnSave": false }}– Tobi Kremer
Aug 21 '17 at 9:18
FWIW, this also works the other way around to exclude only certain types from getting formatted:
{ "editor.formatOnSave": true, "[handlebars]": { "editor.formatOnSave": false }}– Tobi Kremer
Aug 21 '17 at 9:18
Thanks for the handlebars snippet.
– KevinOrfas
Sep 20 '17 at 13:51
Thanks for the handlebars snippet.
– KevinOrfas
Sep 20 '17 at 13:51
Very handy. Any chance it's possible to exclude folders?
– slashwhatever
Mar 22 at 9:27
Very handy. Any chance it's possible to exclude folders?
– slashwhatever
Mar 22 at 9:27
What about
. files such as .babelrc?– fencepencil
Jul 25 at 13:37
What about
. files such as .babelrc?– fencepencil
Jul 25 at 13:37
|
show 3 more comments
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f44831313%2fis-it-possible-to-exclude-some-file-extensions-in-format-on-save-in-visual-stu%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown