# Disable format-on-save by default \(\#59710\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/76e07d5c9ac38930d051c153b21eeb57ba71cbb4)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 76e07d5c9ac38930d051c153b21eeb57ba71cbb4

Requested commit: 76e07d5c9ac38930d051c153b21eeb57ba71cbb4

Commit: 76e07d5c9ac38930d051c153b21eeb57ba71cbb4

Tree: ffefdb936e88c20c0f844991a7ec3ea93575dc75

Author: Chris Biscardi

Committer: GitHub

## Message

```
Disable format-on-save by default (#59710)

# Objective

Prevent the unexpected modification of files which do not have
established formatting conventions.

Enabling format-on-save by default can cause changes in ecosystems that
don't have established official formatting conventions, or when the
formatting conventions came later through new tools (like JavaScript).

fixes #59427

## Solution

This PR inverts the default, choosing to disable format-on-save by
default, and allowing it to be enabled by users at a global or language
level for any language which has an official formatter. However, any
ecosystem which has an official formatter has been left enabled.

This means languages like Rust, Go, and Zig have `format_on_save`
enabled because they come with official formatting tools, while
JavaScript, C/C++, and Markdown have it disabled by default.

For existing users, this means their custom configurations will stay,
but any values that were previously "default" will be updated.

## Testing

- open a file for the language being tested (ex: `python`)
- formatting should only be enabled if the default for the *language* is
enabled
- formatting can be enabled or disabled at the language level or the
global level in the settings

## Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content adheres to Zed's UI standards
([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
and
[icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md)
guidelines)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

---

Release Notes:

- Disable format-on-save by default, except for languages with official
formatters
```

## Parents

- [480796c16875d106ddd0bd573c9baf4681d9f896](https://git.cafe/gitcafe/zed/commit/480796c16875d106ddd0bd573c9baf4681d9f896?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/76e07d5c9ac38930d051c153b21eeb57ba71cbb4?format=markdown)
