How to exclude files from “format on save” in VSCode?

前端 未结 3 1194
逝去的感伤
逝去的感伤 2020-11-30 23:20

Currently in VSCode settings you can configure format on save as following:

\"editor.formatOnSave\": true
         


        
3条回答
  •  鱼传尺愫
    2020-11-30 23:54

    If you came across this question as I did because you were redirected because of this question VSCode : disable formatting of a specific file (or extension) which says, this is a duplicate (I don't feel so, because I wanted it for a specific file) and you're looking for a "one-time" solution:

    VS Code has a shortcut "now" (I don't know since when) for saving a file without formatting listed under the command workbench.action.files.saveWithoutFormatting - Default keybinding should be

    CTRL + K CTRL + SHIFT + S 
    

    (simply keep CTRL pressed and then type K + SHIFT + S).

    On OS X the default keybinding is

    CMD + k then press s

提交回复
热议问题