Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VSCode : disable formatting of a specific file (or extension) [duplicate]

Using Visual Studio Code, is it possible to disable the formatting of a specific file (or extension)?

I try to use some Handlebars templates and I don't want VSCode to format them, at all. A simple example would be :

{{test1}}

{{test2}}

When I save this file (I do have - and want - "editor.formatOnSave" set to true), VsCode transforms the content to

 {{test1}} {{test2}}

The only way I found for the file to stay untouched, is to name it "template.txt" instead of "template.hbs".

Any idea?

like image 771
electrotype Avatar asked Jan 21 '17 15:01

electrotype


Video Answer


1 Answers

You can add file-specific exclusions like so:

"[handlebars]": { "editor.formatOnSave": false },
like image 63
redOctober13 Avatar answered Sep 19 '22 15:09

redOctober13