Skip to content

Confusing settings descriptions about actions and auto save #230051

@elias-pap

Description

@elias-pap

The problem

In VSCode settings, editor.formatOnSave setting has the following description:

Format a file on save. A formatter must be available, the file must not be saved after delay, and the editor must not be shutting down.

"the file must not be saved after delay" part made me assume that the format on save feature will never work when files.autoSave is set to afterDelay.
But that's not true because the formatting is still applied when the file is saved explicitly.

I understand that what you're trying to communicate is that the formatting won't be applied automatically, when the file is saved automatically. But it can still be applied manually when the file is explicitly saved.

The same is true for the descriptions of notebook.formatOnSave and notebook.codeActionsOnSave settings. editor.codeActionsOnSave is an outlier since it doesn't contain that part in the description, but the same is true for this option as well, so it can be updated for consistency.

Attaching related screencasts, to demonstrate.

editor.formatOnSave with auto save set to "off":

auto-save-off-file-format.mov

editor.formatOnSave with auto save set to "afterDelay":

auto-save-on-file-format.mov

Does this issue occur when all extensions are disabled?

Yes

System info

  • VS Code Version: 1.93.1 (Universal)
  • OS Version: Darwin arm64 23.6.0
Version: 1.93.1 (Universal)
Commit: 38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40
Date: 2024-09-11T17:20:05.685Z
Electron: 30.4.0
ElectronBuildId: 10073054
Chromium: 124.0.6367.243
Node.js: 20.15.1
V8: 12.4.254.20-electron.0
OS: Darwin arm64 23.6.0

Steps to Reproduce:

You can try to reproduce what is depicted in the second video above.

  1. Set editor.defaultFormatter setting to vscode.typescript-language-features.
  2. Enable editor.formatOnSave setting.
  3. Set files.autoSave to afterDelay.
  4. Open a TypeScript file, e.g. https://github.com/microsoft/vscode/blob/main/src/vs/workbench/contrib/files/browser/files.contribution.ts
  5. Make a whitespace change, e.g. add a few spaces to the end of a line.
  6. Save the file manually.

The file is not auto-formatted after step 5 even though the file is auto saved, but it is after step 6 (the whitespace added in step 5 is gone).

Metadata

Metadata

Labels

insiders-releasedPatch has been released in VS Code Insiders

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions