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

别等时光非礼了梦想. 提交于 2019-12-05 20:25:58

问题


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?


回答1:


You can add file-specific exclusions like so:

"[handlebars]": { "editor.formatOnSave": false },


来源:https://stackoverflow.com/questions/41781045/vscode-disable-formatting-of-a-specific-file-or-extension

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!