Skip to content

Allow autoSave and formatOnSave #45997

Closed
Closed
@andrecasal

Description

@andrecasal

VS Code documentation regarding configuration says that formatOnSave only works when autoSave is turned off.

The formatOnSave config:

// Format a file on save. A formatter must be available, the file must not be auto-saved,
// and editor must not be shutting down.
  "editor.formatOnSave": true,

and the autoSave config:

// Controls auto save of dirty files. Accepted values:  'off', 'afterDelay',
// 'onFocusChange' (editor loses focus), 'onWindowChange' (window loses focus).
// If set to 'afterDelay', you can configure the delay in 'files.autoSaveDelay'.
  "files.autoSave": "off",

// Controls the delay in ms after which a dirty file is saved automatically.
// Only applies when 'files.autoSave' is set to 'afterDelay'
  "files.autoSaveDelay": 1000,

Both live inside the user settings.

It would be a great developer experience to have files automatically saved AND format the documents automatically.

There's a closed issue with a similar title #37820, but the author was looking to solve an extension bug and it got closed when it was solved. I think this issue remains an important feature request.

Metadata

Metadata

Assignees

Labels

*out-of-scopePosted issue is not in scope of VS Codefeature-requestRequest for new features or functionalityformattingSource formatter issues

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions