settings: Introduce PRESERVED_KEYS to write default values (#15474)

This adds the optional `PRESERVED_KEYS` constant to the `Settings`
trait,
which allows users of the trait to specify which keys should be written
to
the settings file, even if their current value matches the default
value.

That's useful for tagged settings that have, for example, a `"version"`
field
that should always be present in the user settings file, so we can then
reparse
the user settings based on the version.

Co-Authored-By: Thorsten <thorsten@zed.dev>

Release Notes:

- N/A

---------

Co-authored-by: Thorsten <thorsten@zed.dev>
This commit is contained in:
Bennet Bo Fenner 2024-07-30 13:09:50 +02:00 committed by GitHub
parent fa19bc98ac
commit 0540291204
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 85 additions and 96 deletions

1
Cargo.lock generated
View file

@ -439,6 +439,7 @@ dependencies = [
"semantic_index",
"serde",
"serde_json",
"serde_json_lenient",
"settings",
"similar",
"smol",