Skip to content

Settings profile base option#52456

Merged
JosephTLyons merged 22 commits intomainfrom
settings-profile-base-option
Apr 2, 2026
Merged

Settings profile base option#52456
JosephTLyons merged 22 commits intomainfrom
settings-profile-base-option

Conversation

@JosephTLyons
Copy link
Copy Markdown
Collaborator

@JosephTLyons JosephTLyons commented Mar 25, 2026

Context

This PR introduces a base field for settings profiles to allow profiles to either overlay user settings or to overlay default, which is simply zed's defaults (user settings are skipped). I'm not entirely sure I love default because it's a bit confusing (there's a setting called default but the default is user). Another idea I had was factory (user (default) or factory) - curious to hear from the reviewers. This will be useful for those of us who need to quickly flip to a default state, or a default state with some customizations on top. Additionally, from what I can tell, VS Code's profile system is more in line with what this PR is offering in Zed - profiles overlay the default settings, not the user's customization layer. So this will be familiar for those users.

I've had no issue with the migrator, code is pretty simple there, but would love for @smitbarmase to review the migration to make sure I'm not missing something.

Self-Review Checklist

  • I've reviewed my own diff for quality, security, and reliability
  • Unsafe blocks (if any) have justifying comments
  • The content is consistent with the UI/UX checklist
  • Tests cover the new/changed behavior
  • Performance impact has been considered and is acceptable

Release Notes:

  • Improved the flexibility of settings profiles by offering a way for profiles to lay atop of zed defaults, skipping user settings all together. Settings Profiles now take the following form.
"Your Profile": {
  "base": "user" // or "default"
  "settings": {
    // ...
  },
},

@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label Mar 25, 2026
@zed-codeowner-coordinator zed-codeowner-coordinator Bot requested review from a team, MrSubidubi and maxbrunsfeld and removed request for a team March 25, 2026 23:16
@zed-community-bot zed-community-bot Bot added the staff Pull requests authored by a current member of Zed staff label Mar 25, 2026
@JosephTLyons JosephTLyons force-pushed the settings-profile-base-option branch from bc7b4a2 to 64f0bd7 Compare March 25, 2026 23:32
@github-actions github-actions Bot added Size L large-pr Automation related label for detecting large contributor PRs and removed Size M labels Mar 25, 2026
@github-actions
Copy link
Copy Markdown

📏 PR Size: 425 lines changed (Size L)

Please note: this PR exceeds the 400 LOC soft limit.

  • Consider splitting into separate PRs if the changes are separable
  • Ensure the PR description includes a guided tour in the "How to Review" section so reviewers know where to start

Copy link
Copy Markdown
Member

@MrSubidubi MrSubidubi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As for the naming of base: An idea that came to mind is that we could instead name that enum UserSettings, DefaultSettings for it to be more clear. Another idea would be something like "application" which could then be accumulative or exclusive, naming very much to be discussed (and still think I like your current approach more).

Comment thread crates/settings/src/settings_store.rs Outdated
This changes the structure of settings profiles to include a 'settings' key
and adds an optional 'base' field that controls what settings the profile
starts from:

- 'user' (default): Apply profile on top of user's settings
- 'default': Apply profile on top of Zed's defaults, ignoring user settings

New JSON format:
{
  "profiles": {
    "Presenting": {
      "settings": { "buffer_font_size": 20.0 }
    },
    "Clean Slate": {
      "base": "default",
      "settings": { "theme": "Ayu Dark" }
    }
  }
}
Both fields now use #[serde(default)], so profiles can omit either:
- base defaults to 'user'
- settings defaults to empty
- Move tests from settings_store.rs to settings_profile_selector.rs so
  they go through the picker like production code
- Refactor init_test to accept full user settings JSON instead of just
  profiles, making each test explicit about its setup
- Expand test_settings_profile_with_default_base to verify profile
  settings apply on top of factory defaults
Wraps old profile settings in a 'settings' key:
  Before: { "Presenting": { "buffer_font_size": 20 } }
  After:  { "Presenting": { "settings": { "buffer_font_size": 20 } } }

Also updates migrate_settings and migrate_language_setting helpers to
handle both old and new profile formats, so migrations registered
before and after this one both work correctly.
Profiles with a 'base' key but no 'settings' key are already in the
new format. Without this check, the migration incorrectly wraps
the base key into settings, breaking the profile behavior.
Each profile row now displays a small muted label indicating
its base type (User or Default) with a tooltip explaining
the behavior.
@JosephTLyons JosephTLyons force-pushed the settings-profile-base-option branch from 4020865 to 45ae503 Compare March 31, 2026 19:46
@JosephTLyons JosephTLyons enabled auto-merge (squash) April 2, 2026 00:34
@JosephTLyons JosephTLyons merged commit 3941f44 into main Apr 2, 2026
30 checks passed
@JosephTLyons JosephTLyons deleted the settings-profile-base-option branch April 2, 2026 00:44
piper-of-dawn pushed a commit to piper-of-dawn/zed that referenced this pull request Apr 25, 2026
## Context

This PR introduces a `base` field for settings profiles to allow
profiles to either overlay `user` settings or to overlay `default`,
which is simply zed's defaults (user settings are skipped). I'm not
entirely sure I love `default` because it's a bit confusing (there's a
setting called `default` but the default is `user`). Another idea I had
was `factory` (`user` (default) or `factory`) - curious to hear from the
reviewers. This will be useful for those of us who need to quickly flip
to a default state, or a default state with some customizations on top.
Additionally, from what I can tell, VS Code's profile system is more in
line with what this PR is offering in Zed - profiles overlay the default
settings, not the user's customization layer. So this will be familiar
for those users.

I've had no issue with the migrator, code is pretty simple there, but
would love for @smitbarmase to review the migration to make sure I'm not
missing something.

## Self-Review Checklist

<!-- Check before requesting review: -->
- [X] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [ ] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [X] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- Improved the flexibility of settings profiles by offering a way for
profiles to lay atop of zed defaults, skipping user settings all
together. Settings Profiles now take the following form.

```json5
"Your Profile": {
  "base": "user" // or "default"
  "settings": {
    // ...
  },
},
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement large-pr Automation related label for detecting large contributor PRs staff Pull requests authored by a current member of Zed staff

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants