jsonvisual-studio-codeformattingautoformattingvs-code-settings

How to enable auto formatting for specific subfolders only?


When working on a team project with various preferences, how can one enable auto formatting on a specific folder (not file type) only?

For example:

"[folder:my-subfolder/sub-folder-2]":
{
    "editor.formatOnSave": true,
}

I've read that it's not possible to add a separate settings.json per folder. Is there another way to do this? Or is it not possible at this moment?


Solution

  • At the time of this writing, this has been declared out of scope (as a core VS Code feature) twice now.

    1. Setting to exclude file patterns from editor.formatOnSave #147677
    2. Exclude files or directories from editor.formatOnSave #176946

    If you think that the feature-request is crucial, share your use-case in #176946 (please do so politely and with humility if you can).