6216af9b5a19ef55b6192bf84b6ef3965c7b93c8
set_theme based on Appearance (#42812)
Tracking Issue (does not close): https://github.com/zed-industries/zed/issues/35552 This is somewhat of a blocker for https://github.com/zed-industries/zed/pull/40035 (but also the current behavior doesn't really make sense). The current behavior of `ThemeSelectorDelegate::set_theme` (the theme selector menu) is to simply set the in-memory settings to `Static`, regardless of if it is currently `Dynamic`. The reason this doesn't matter now is that the `theme::set_theme` function that updates the user's settings file _will_ make this check, so dynamic settings stay dynamic in `settings.json`, but not in memory. But this is also sort of strange, because `theme::set_theme` will set the setting of whatever the old appearance was to the new theme name. In other words, if I am currently on a light mode theme and I change my theme to a dark mode theme using the theme selector, the `light` field of `theme` in `settings.json` is set to a dark mode theme! _I think this is because displaying the new theme in the theme selector does not update the global context, so `ThemeSettings::get_global(cx).theme.name(appearance).0` returns the original theme appearance, not the new one._ --- This PR makes `ThemeSelectorDelegate::set_theme` keep the current `ThemeSelection`, as well as changes the behavior of the `theme::set_theme` call to always choose the correct setting to update. One edge case that might be slightly strange now is that if the user has specified the mode as `System`, this will now override that with the appearance of the new theme. I think this is fine, as otherwise a user might set a dark theme and nothing will change because the `ThemeAppearanceMode` is set to `light` or `system` (where `system` is also light). I also have an `unreachable!` in there that I'm pretty sure is true but I don't really know how to formally prove that... Release Notes: - N/A *or* Added/Fixed/Improved ... --------- Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
Zed
Welcome to Zed, a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Installation
On macOS, Linux, and Windows you can download Zed directly or install Zed via your local package manager.
Other platforms are not yet available:
- Web (tracking issue)
Developing Zed
- Building Zed for macOS
- Building Zed for Linux
- Building Zed for Windows
- Running Collaboration Locally
Contributing
See CONTRIBUTING.md for ways you can contribute to Zed.
Also... we're hiring! Check out our jobs page for open roles.
Licensing
License information for third party dependencies must be correctly provided for CI to pass.
We use cargo-about to automatically comply with open source licenses. If CI is failing, check the following:
- Is it showing a
no license specifiederror for a crate you've created? If so, addpublish = falseunder[package]in your crate's Cargo.toml. - Is the error
failed to satisfy license requirementsfor a dependency? If so, first determine what license the project has and whether this system is sufficient to comply with this license's requirements. If you're unsure, ask a lawyer. Once you've verified that this system is acceptable add the license's SPDX identifier to theacceptedarray inscript/licenses/zed-licenses.toml. - Is
cargo-aboutunable to find the license for a dependency? If so, add a clarification field at the end ofscript/licenses/zed-licenses.toml, as specified in the cargo-about book.
Description
Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Readme
586 MiB
Languages
Rust
94.7%
JSON-with-Comments
3.1%
Inno Setup
0.6%
Scheme
0.5%
Shell
0.3%
Other
0.4%