From ea39983f7858a978e276357a99f8942d12c5913d Mon Sep 17 00:00:00 2001 From: Mikayla Maki Date: Mon, 23 Jan 2023 14:31:10 -0800 Subject: [PATCH] Removed old experiments settings and staff mode flag, added new StaffMode global that is set based on the webserver's staff bit --- .dockerignore | 2 +- .gitignore | 3 +-- Cargo.lock | 1 + README.md | 25 ++----------------- assets/keymaps/internal.json | 1 - crates/client/src/user.rs | 11 +++++++- crates/collab/src/tests.rs | 3 +-- crates/fs/src/fs.rs | 11 -------- crates/project/src/project.rs | 1 - crates/project/src/worktree.rs | 7 +++--- crates/settings/src/keymap_file.rs | 13 ++-------- crates/settings/src/settings.rs | 24 ------------------ crates/theme/src/theme_registry.rs | 13 +++------- crates/theme_selector/Cargo.toml | 1 + crates/theme_selector/src/theme_selector.rs | 6 ++--- crates/util/src/paths.rs | 13 +++++++++- crates/workspace/src/workspace.rs | 3 --- crates/zed/src/main.rs | 14 ++++++++--- crates/zed/src/zed.rs | 15 ++++++----- styles/src/buildThemes.ts | 11 +++----- styles/src/colorSchemes.ts | 12 +++------ styles/src/themes/experiments/.gitkeep | 0 styles/src/themes/internal/.gitkeep | 0 .../src/themes/staff}/.gitkeep | 0 .../themes/{experiments => staff}/abruzzo.ts | 0 .../{internal => staff}/atelier-dune.ts | 0 .../{internal => staff}/atelier-heath.ts | 0 .../{internal => staff}/atelier-seaside.ts | 0 .../themes/{internal => staff}/ayu-mirage.ts | 0 styles/src/themes/{internal => staff}/ayu.ts | 0 .../{experiments => staff}/brushtrees.ts | 0 .../src/themes/{internal => staff}/dracula.ts | 0 .../{internal => staff}/gruvbox-medium.ts | 0 .../src/themes/{internal => staff}/monokai.ts | 0 styles/src/themes/{internal => staff}/nord.ts | 0 .../src/themes/{internal => staff}/seti-ui.ts | 0 .../{internal => staff}/tokyo-night-storm.ts | 0 .../themes/{internal => staff}/tokyo-night.ts | 0 .../src/themes/{internal => staff}/zed-pro.ts | 0 .../src/themes/{internal => staff}/zenburn.ts | 0 40 files changed, 66 insertions(+), 124 deletions(-) delete mode 100644 assets/keymaps/internal.json delete mode 100644 styles/src/themes/experiments/.gitkeep delete mode 100644 styles/src/themes/internal/.gitkeep rename {assets/keymaps/experiments => styles/src/themes/staff}/.gitkeep (100%) rename styles/src/themes/{experiments => staff}/abruzzo.ts (100%) rename styles/src/themes/{internal => staff}/atelier-dune.ts (100%) rename styles/src/themes/{internal => staff}/atelier-heath.ts (100%) rename styles/src/themes/{internal => staff}/atelier-seaside.ts (100%) rename styles/src/themes/{internal => staff}/ayu-mirage.ts (100%) rename styles/src/themes/{internal => staff}/ayu.ts (100%) rename styles/src/themes/{experiments => staff}/brushtrees.ts (100%) rename styles/src/themes/{internal => staff}/dracula.ts (100%) rename styles/src/themes/{internal => staff}/gruvbox-medium.ts (100%) rename styles/src/themes/{internal => staff}/monokai.ts (100%) rename styles/src/themes/{internal => staff}/nord.ts (100%) rename styles/src/themes/{internal => staff}/seti-ui.ts (100%) rename styles/src/themes/{internal => staff}/tokyo-night-storm.ts (100%) rename styles/src/themes/{internal => staff}/tokyo-night.ts (100%) rename styles/src/themes/{internal => staff}/zed-pro.ts (100%) rename styles/src/themes/{internal => staff}/zenburn.ts (100%) diff --git a/.dockerignore b/.dockerignore index add07b4bf7204e92fbb14bd0f92128ec714e8865..d89a9d83e2f9c4a393e3c793b0f0c77d362e2cc3 100644 --- a/.dockerignore +++ b/.dockerignore @@ -8,4 +8,4 @@ crates/collab/static/styles.css vendor/bin assets/themes/*.json assets/themes/internal/*.json -assets/themes/experiments/*.json +assets/themes/staff/*.json diff --git a/.gitignore b/.gitignore index 69dbbd3e1c939776a35d83c63217993242c4e126..5a4d2ff25e19e7406f79c1b627510f4c94d58212 100644 --- a/.gitignore +++ b/.gitignore @@ -7,9 +7,8 @@ /crates/collab/static/styles.css /vendor/bin /assets/themes/*.json -/assets/themes/Internal/*.json -/assets/themes/Experiments/*.json /assets/*licenses.md +/assets/themes/staff/*.json **/venv .build Packages diff --git a/Cargo.lock b/Cargo.lock index 0c0744d3a986181740bb2e2344bbede0dfc22019..914e61226dd8451eb763a1bbe13152b1a1dd71d7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6466,6 +6466,7 @@ dependencies = [ "settings", "smol", "theme", + "util", "workspace", ] diff --git a/README.md b/README.md index 24614e97c271176f6939b3199c9a3e7613fc504b..af8eeffb9c8e5943a9fc3aa6fa78c63c6c533376 100644 --- a/README.md +++ b/README.md @@ -49,30 +49,9 @@ script/zed-with-local-servers --release If you trigger `cmd-alt-i`, Zed will copy a JSON representation of the current window contents to the clipboard. You can paste this in a tool like [DJSON](https://chrome.google.com/webstore/detail/djson-json-viewer-formatt/chaeijjekipecdajnijdldjjipaegdjc?hl=en) to navigate the state of on-screen elements in a structured way. -### Staff Only Features +### Licensing -Many features (e.g. the terminal) take significant time and effort before they are polished enough to be released to even Alpha users. But Zed's team workflow relies on fast, daily PRs and there can be large merge conflicts for feature branchs that diverge for a few days. To bridge this gap, there is a `staff_mode` field in the Settings that staff can set to enable these unpolished or incomplete features. Note that this setting isn't leaked via autocompletion, but there is no mechanism to stop users from setting this anyway. As initilization of Zed components is only done once, on startup, setting `staff_mode` may require a restart to take effect. You can set staff only key bindings in the `assets/keymaps/internal.json` file, and add staff only themes in the `styles/src/themes/internal` directory - -### Experimental Features - -A user facing feature flag can be added to Zed by: - -* Adding a setting to the crates/settings/src/settings.rs FeatureFlags struct. Use a boolean for a simple on/off, or use a struct to experiment with different configuration options. -* If the feature needs keybindings, add a file to the `assets/keymaps/experiments/` folder, then update the `FeatureFlags::keymap_files()` method to check for your feature's flag and add it's keybindings's path to the method's list. -* If you want to add an experimental theme, add it to the `styles/src/themes/experiments` folder - -The Settings global should be initialized with the user's feature flags by the time the feature's `init(cx)` equivalent is called. - -To promote an experimental feature to a full feature: - -* If this is an experimental theme, move the theme file from the `styles/src/themes/experiments` folder to the `styles/src/themes/` folder -* Take the features settings (if any) and add them under a new variable in the Settings struct. Don't forget to add a `merge()` call in `set_user_settings()`! -* Take the feature's keybindings and add them to the default.json (or equivalent) file -* Remove the file from the `FeatureFlags::keymap_files()` method -* Remove the conditional in the feature's `init(cx)` equivalent. - - -That's it 😸 +We use cargo-about to automatically comply with open source licenses. If CI is failing due to an unsupported license, first check whether this system is able to support this license type; ask a lawyer if you're unsure. Once you've verified the license, go to `script/licenses/zed-licenses.toml` and add the associated `accepted` SPDX identifier. If cargo about cannot find the license for the dependency at all, add a clarification field at the end of the file, as specified in the [cargo-about book](https://embarkstudios.github.io/cargo-about/cli/generate/config.html#crate-configuration). ### Wasm Plugins diff --git a/assets/keymaps/internal.json b/assets/keymaps/internal.json deleted file mode 100644 index 0637a088a01e8ddab3bf3fa98dbe804cbde1a0dc..0000000000000000000000000000000000000000 --- a/assets/keymaps/internal.json +++ /dev/null @@ -1 +0,0 @@ -[] \ No newline at end of file diff --git a/crates/client/src/user.rs b/crates/client/src/user.rs index 1201665571e16b63b92d2397043e7d0266548e85..ab952614617a21e87b022fdc060454942432016a 100644 --- a/crates/client/src/user.rs +++ b/crates/client/src/user.rs @@ -7,7 +7,7 @@ use postage::{sink::Sink, watch}; use rpc::proto::{RequestMessage, UsersResponse}; use settings::Settings; use std::sync::{Arc, Weak}; -use util::TryFutureExt as _; +use util::{paths::StaffMode, TryFutureExt as _}; #[derive(Default, Debug)] pub struct User { @@ -148,6 +148,15 @@ impl UserStore { cx.read(|cx| cx.global::().telemetry()), ); + cx.update(|cx| { + cx.update_global::(|staff_mode, _| { + *staff_mode = info + .as_ref() + .map(|info| StaffMode(info.staff)) + .unwrap_or(StaffMode(false)); + }) + }); + current_user_tx.send(user).await.ok(); } } diff --git a/crates/collab/src/tests.rs b/crates/collab/src/tests.rs index 120c577e0f215c42068003ed39b3acc9ebbd07ab..e9ffecf246d295934e15a2a3375af60f78a18c3e 100644 --- a/crates/collab/src/tests.rs +++ b/crates/collab/src/tests.rs @@ -11,7 +11,7 @@ use client::{ EstablishConnectionError, UserStore, }; use collections::{HashMap, HashSet}; -use fs::{FakeFs, HomeDir}; +use fs::FakeFs; use futures::{channel::oneshot, StreamExt as _}; use gpui::{ executor::Deterministic, test::EmptyView, ModelHandle, Task, TestAppContext, ViewHandle, @@ -100,7 +100,6 @@ impl TestServer { async fn create_client(&mut self, cx: &mut TestAppContext, name: &str) -> TestClient { cx.update(|cx| { - cx.set_global(HomeDir(Path::new("/tmp/").to_path_buf())); cx.set_global(Settings::test(cx)); }); diff --git a/crates/fs/src/fs.rs b/crates/fs/src/fs.rs index 6a79953f41f25c3c8d5037d17b63aec5adb230cc..f640f35036d3ff3a26566f2058e22cf64d7efa27 100644 --- a/crates/fs/src/fs.rs +++ b/crates/fs/src/fs.rs @@ -13,7 +13,6 @@ use smol::io::{AsyncReadExt, AsyncWriteExt}; use std::borrow::Cow; use std::cmp; use std::io::Write; -use std::ops::Deref; use std::sync::Arc; use std::{ io, @@ -94,16 +93,6 @@ impl LineEnding { } } -pub struct HomeDir(pub PathBuf); - -impl Deref for HomeDir { - type Target = PathBuf; - - fn deref(&self) -> &Self::Target { - &self.0 - } -} - #[async_trait::async_trait] pub trait Fs: Send + Sync { async fn create_dir(&self, path: &Path) -> Result<()>; diff --git a/crates/project/src/project.rs b/crates/project/src/project.rs index 54939af8d8dd4a7c684e1747e025bccc49c1e34d..8f6b867b1210d950b4675973783604a752ade650 100644 --- a/crates/project/src/project.rs +++ b/crates/project/src/project.rs @@ -550,7 +550,6 @@ impl Project { if !cx.read(|cx| cx.has_global::()) { cx.update(|cx| { cx.set_global(Settings::test(cx)); - cx.set_global(HomeDir(Path::new("/tmp/").to_path_buf())) }); } diff --git a/crates/project/src/worktree.rs b/crates/project/src/worktree.rs index b65cf9e39bd96367a3e0b0d45989fcbdce76cf9b..d743ba203179e54ada445e62acaf9880f05f3153 100644 --- a/crates/project/src/worktree.rs +++ b/crates/project/src/worktree.rs @@ -5,8 +5,8 @@ use anyhow::{anyhow, Context, Result}; use client::{proto, Client}; use clock::ReplicaId; use collections::{HashMap, VecDeque}; +use fs::LineEnding; use fs::{repository::GitRepository, Fs}; -use fs::{HomeDir, LineEnding}; use futures::{ channel::{ mpsc::{self, UnboundedSender}, @@ -49,6 +49,7 @@ use std::{ time::{Duration, SystemTime}, }; use sum_tree::{Bias, Edit, SeekTarget, SumTree, TreeMap, TreeSet}; +use util::paths::HOME; use util::{ResultExt, TryFutureExt}; #[derive(Copy, Clone, PartialEq, Eq, Debug, Hash, PartialOrd, Ord)] @@ -1831,9 +1832,9 @@ impl language::File for File { } else { let path = worktree.abs_path(); - if worktree.is_local() && path.starts_with(cx.global::().as_path()) { + if worktree.is_local() && path.starts_with(HOME.as_path()) { full_path.push("~"); - full_path.push(path.strip_prefix(cx.global::().as_path()).unwrap()); + full_path.push(path.strip_prefix(HOME.as_path()).unwrap()); } else { full_path.push(path) } diff --git a/crates/settings/src/keymap_file.rs b/crates/settings/src/keymap_file.rs index 4090bcc63af42b70507bf840378d3bc2b7a7725a..01992d94311e7dd348b06d3a7b6b042780204010 100644 --- a/crates/settings/src/keymap_file.rs +++ b/crates/settings/src/keymap_file.rs @@ -1,4 +1,4 @@ -use crate::{parse_json_with_comments, Settings}; +use crate::parse_json_with_comments; use anyhow::{Context, Result}; use assets::Assets; use collections::BTreeMap; @@ -42,16 +42,7 @@ struct ActionWithData(Box, Box); impl KeymapFileContent { pub fn load_defaults(cx: &mut MutableAppContext) { - let settings = cx.global::(); - let mut paths = vec!["keymaps/default.json", "keymaps/vim.json"]; - - if settings.staff_mode { - paths.push("keymaps/internal.json") - } - - paths.extend(settings.experiments.keymap_files()); - - for path in paths { + for path in ["keymaps/default.json", "keymaps/vim.json"] { Self::load(path, cx).unwrap(); } } diff --git a/crates/settings/src/settings.rs b/crates/settings/src/settings.rs index 6e25222d96eb83079db7c1805dc7d32b8aa198e3..a184c9a929eb06464b558a7064eb9198adcb270f 100644 --- a/crates/settings/src/settings.rs +++ b/crates/settings/src/settings.rs @@ -27,7 +27,6 @@ pub use keymap_file::{keymap_file_json_schema, KeymapFileContent}; #[derive(Clone)] pub struct Settings { - pub experiments: FeatureFlags, pub buffer_font_family: FamilyId, pub default_buffer_font_size: f32, pub buffer_font_size: f32, @@ -53,7 +52,6 @@ pub struct Settings { pub theme: Arc, pub telemetry_defaults: TelemetrySettings, pub telemetry_overrides: TelemetrySettings, - pub staff_mode: bool, } #[derive(Copy, Clone, Debug, Default, Serialize, Deserialize, JsonSchema)] @@ -71,17 +69,6 @@ impl TelemetrySettings { } } -#[derive(Copy, Clone, Debug, Default, Serialize, Deserialize, JsonSchema)] -pub struct FeatureFlags { - pub experimental_themes: bool, -} - -impl FeatureFlags { - pub fn keymap_files(&self) -> Vec<&'static str> { - vec![] - } -} - #[derive(Copy, Clone, Debug, Default, Serialize, Deserialize, JsonSchema)] pub struct GitSettings { pub git_gutter: Option, @@ -283,7 +270,6 @@ impl Column for DockAnchor { #[derive(Clone, Debug, Default, Serialize, Deserialize, JsonSchema)] pub struct SettingsFileContent { - pub experiments: Option, #[serde(default)] pub projects_online_by_default: Option, #[serde(default)] @@ -323,8 +309,6 @@ pub struct SettingsFileContent { pub theme: Option, #[serde(default)] pub telemetry: TelemetrySettings, - #[serde(default)] - pub staff_mode: Option, } #[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq, JsonSchema)] @@ -352,7 +336,6 @@ impl Settings { .unwrap(); Self { - experiments: FeatureFlags::default(), buffer_font_family: font_cache .load_family(&[defaults.buffer_font_family.as_ref().unwrap()]) .unwrap(), @@ -388,7 +371,6 @@ impl Settings { theme: themes.get(&defaults.theme.unwrap()).unwrap(), telemetry_defaults: defaults.telemetry, telemetry_overrides: Default::default(), - staff_mode: false, } } @@ -425,8 +407,6 @@ impl Settings { ); merge(&mut self.vim_mode, data.vim_mode); merge(&mut self.autosave, data.autosave); - merge(&mut self.experiments, data.experiments); - merge(&mut self.staff_mode, data.staff_mode); merge(&mut self.default_dock_anchor, data.default_dock_anchor); // Ensure terminal font is loaded, so we can request it in terminal_element layout @@ -552,7 +532,6 @@ impl Settings { #[cfg(any(test, feature = "test-support"))] pub fn test(cx: &gpui::AppContext) -> Settings { Settings { - experiments: FeatureFlags::default(), buffer_font_family: cx.font_cache().load_family(&["Monaco"]).unwrap(), buffer_font_size: 14., active_pane_magnification: 1., @@ -589,7 +568,6 @@ impl Settings { metrics: Some(true), }, telemetry_overrides: Default::default(), - staff_mode: false, } } @@ -647,8 +625,6 @@ pub fn settings_file_json_schema( ]); let root_schema_object = &mut root_schema.schema.object.as_mut().unwrap(); - // Avoid automcomplete for non-user facing settings - root_schema_object.properties.remove("staff_mode"); root_schema_object.properties.extend([ ( "theme".to_owned(), diff --git a/crates/theme/src/theme_registry.rs b/crates/theme/src/theme_registry.rs index 3d4783604d3b9a2d9933f9e367a7ea26fb032397..cc5e5490afc1d18ae200d01059a2b734cfb1615b 100644 --- a/crates/theme/src/theme_registry.rs +++ b/crates/theme/src/theme_registry.rs @@ -22,20 +22,13 @@ impl ThemeRegistry { }) } - pub fn list(&self, internal: bool, experiments: bool) -> impl Iterator + '_ { + pub fn list(&self, staff: bool) -> impl Iterator + '_ { let mut dirs = self.assets.list("themes/"); - if !internal { + if !staff { dirs = dirs .into_iter() - .filter(|path| !path.starts_with("themes/Internal")) - .collect() - } - - if !experiments { - dirs = dirs - .into_iter() - .filter(|path| !path.starts_with("themes/Experiments")) + .filter(|path| !path.starts_with("themes/staff")) .collect() } diff --git a/crates/theme_selector/Cargo.toml b/crates/theme_selector/Cargo.toml index 8f6fc7460015a95532a02167a5016d08eab9641f..80ff31106948dec501b4d13863491964d9105ca6 100644 --- a/crates/theme_selector/Cargo.toml +++ b/crates/theme_selector/Cargo.toml @@ -16,6 +16,7 @@ picker = { path = "../picker" } theme = { path = "../theme" } settings = { path = "../settings" } workspace = { path = "../workspace" } +util = { path = "../util" } log = { version = "0.4.16", features = ["kv_unstable_serde"] } parking_lot = "0.11.1" postage = { version = "0.4.1", features = ["futures-traits"] } diff --git a/crates/theme_selector/src/theme_selector.rs b/crates/theme_selector/src/theme_selector.rs index 252a64c7fda465c9ad4b69ae013fd71f189054c1..45dc36a3adf191edd60ca795a26dd1d3bf18b691 100644 --- a/crates/theme_selector/src/theme_selector.rs +++ b/crates/theme_selector/src/theme_selector.rs @@ -7,6 +7,7 @@ use picker::{Picker, PickerDelegate}; use settings::{settings_file::SettingsFile, Settings}; use std::sync::Arc; use theme::{Theme, ThemeMeta, ThemeRegistry}; +use util::paths::StaffMode; use workspace::{AppState, Workspace}; pub struct ThemeSelector { @@ -44,10 +45,7 @@ impl ThemeSelector { let original_theme = settings.theme.clone(); let mut theme_names = registry - .list( - settings.staff_mode, - settings.experiments.experimental_themes, - ) + .list(**cx.global::()) .collect::>(); theme_names.sort_unstable_by(|a, b| { a.is_light diff --git a/crates/util/src/paths.rs b/crates/util/src/paths.rs index 8698d6891e18e7e3e960a210ec7b3f23e308da72..94af0aa75dba6d9d60fce2fccf27665cdaf76068 100644 --- a/crates/util/src/paths.rs +++ b/crates/util/src/paths.rs @@ -1,4 +1,15 @@ -use std::path::PathBuf; +use std::{ops::Deref, path::PathBuf}; + +#[derive(Debug)] +pub struct StaffMode(pub bool); + +impl Deref for StaffMode { + type Target = bool; + + fn deref(&self) -> &Self::Target { + &self.0 + } +} lazy_static::lazy_static! { pub static ref HOME: PathBuf = dirs::home_dir().expect("failed to determine home directory"); diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rs index e5f22d1169a1860da8f1be47c10bced37cfce33a..0abc25724c4614ef28850e95d7bd1d447527ef22 100644 --- a/crates/workspace/src/workspace.rs +++ b/crates/workspace/src/workspace.rs @@ -349,9 +349,6 @@ pub struct AppState { impl AppState { #[cfg(any(test, feature = "test-support"))] pub fn test(cx: &mut MutableAppContext) -> Arc { - use fs::HomeDir; - - cx.set_global(HomeDir(Path::new("/tmp/").to_path_buf())); let settings = Settings::test(cx); cx.set_global(settings); diff --git a/crates/zed/src/main.rs b/crates/zed/src/main.rs index 56f259339c58ff6afb44b2eb6077b03b7d4ae1ac..4cef2c07758c1930483ffd72c522decf9f7081d5 100644 --- a/crates/zed/src/main.rs +++ b/crates/zed/src/main.rs @@ -24,7 +24,7 @@ use isahc::{config::Configurable, Request}; use language::LanguageRegistry; use log::LevelFilter; use parking_lot::Mutex; -use project::{Fs, HomeDir}; +use project::Fs; use serde_json::json; use settings::{ self, settings_file::SettingsFile, KeymapFileContent, Settings, SettingsFileContent, @@ -39,7 +39,11 @@ use terminal_view::{get_working_directory, TerminalView}; use fs::RealFs; use settings::watched_json::{watch_keymap_file, watch_settings_file, WatchedJsonFile}; use theme::ThemeRegistry; -use util::{channel::RELEASE_CHANNEL, paths, ResultExt, TryFutureExt}; +use util::{ + channel::RELEASE_CHANNEL, + paths::{self, StaffMode}, + ResultExt, TryFutureExt, +}; use workspace::{ self, item::ItemHandle, notifications::NotifyResultExt, AppState, NewFile, OpenPaths, Workspace, }; @@ -104,7 +108,11 @@ fn main() { app.run(move |cx| { cx.set_global(*RELEASE_CHANNEL); - cx.set_global(HomeDir(paths::HOME.to_path_buf())); + + #[cfg(not(debug_assertions))] + cx.set_global(StaffMode(false)); + #[cfg(debug_assertions)] + cx.set_global(StaffMode(true)); let (settings_file_content, keymap_file) = cx.background().block(config_files).unwrap(); diff --git a/crates/zed/src/zed.rs b/crates/zed/src/zed.rs index a8773d2c0bef878b0955de3de2cc0966d0311f75..af7dfdaee0e3f606994957b5c31bedb1c5fd237a 100644 --- a/crates/zed/src/zed.rs +++ b/crates/zed/src/zed.rs @@ -32,7 +32,11 @@ use serde::Deserialize; use serde_json::to_string_pretty; use settings::{keymap_file_json_schema, settings_file_json_schema, Settings}; use std::{borrow::Cow, env, path::Path, str, sync::Arc}; -use util::{channel::ReleaseChannel, paths, ResultExt}; +use util::{ + channel::ReleaseChannel, + paths::{self, StaffMode}, + ResultExt, +}; use uuid::Uuid; pub use workspace; use workspace::{sidebar::SidebarSide, AppState, Workspace}; @@ -297,14 +301,9 @@ pub fn initialize_workspace( cx.emit(workspace::Event::PaneAdded(workspace.active_pane().clone())); cx.emit(workspace::Event::PaneAdded(workspace.dock_pane().clone())); - let settings = cx.global::(); - let theme_names = app_state .themes - .list( - settings.staff_mode, - settings.experiments.experimental_themes, - ) + .list(**cx.global::()) .map(|meta| meta.name) .collect(); let language_names = app_state.languages.language_names(); @@ -1868,7 +1867,7 @@ mod tests { let settings = Settings::defaults(Assets, cx.font_cache(), &themes); let mut has_default_theme = false; - for theme_name in themes.list(false, false).map(|meta| meta.name) { + for theme_name in themes.list(false).map(|meta| meta.name) { let theme = themes.get(&theme_name).unwrap(); if theme.meta.name == settings.theme.meta.name { has_default_theme = true; diff --git a/styles/src/buildThemes.ts b/styles/src/buildThemes.ts index 6512d13a47f8f04a774e73b76b865e5d758f56cd..4bb7b8fc09dfa596bc5a12ae97e7a1cb5eae963a 100644 --- a/styles/src/buildThemes.ts +++ b/styles/src/buildThemes.ts @@ -2,7 +2,7 @@ import * as fs from "fs"; import { tmpdir } from "os"; import * as path from "path"; import colorSchemes, { - experimentalColorSchemes, internalColorSchemes + staffColorSchemes, } from "./colorSchemes"; import app from "./styleTree/app"; import { ColorScheme } from "./themes/common/colorScheme"; @@ -10,8 +10,7 @@ import snakeCase from "./utils/snakeCase"; const assetsDirectory = `${__dirname}/../../assets` const themeDirectory = `${assetsDirectory}/themes`; -const internalDirectory = `${themeDirectory}/Internal`; -const experimentsDirectory = `${themeDirectory}/Experiments`; +const staffDirectory = `${themeDirectory}/staff`; const tempDirectory = fs.mkdtempSync(path.join(tmpdir(), "build-themes")); @@ -32,8 +31,7 @@ function clearThemes(themeDirectory: string) { } clearThemes(themeDirectory); -clearThemes(internalDirectory); -clearThemes(experimentsDirectory); +clearThemes(staffDirectory); function writeThemes(colorSchemes: ColorScheme[], outputDirectory: string) { for (let colorScheme of colorSchemes) { @@ -49,5 +47,4 @@ function writeThemes(colorSchemes: ColorScheme[], outputDirectory: string) { // Write new themes to theme directory writeThemes(colorSchemes, themeDirectory); -writeThemes(internalColorSchemes, internalDirectory); -writeThemes(experimentalColorSchemes, experimentsDirectory); \ No newline at end of file +writeThemes(staffColorSchemes, staffDirectory); diff --git a/styles/src/colorSchemes.ts b/styles/src/colorSchemes.ts index fdf9b51ebea21d474734e063880f45a6a9b94639..c7e1d4ead7ef8f426400add201351a19f7e9cfcc 100644 --- a/styles/src/colorSchemes.ts +++ b/styles/src/colorSchemes.ts @@ -8,8 +8,8 @@ export default colorSchemes; const schemeMeta: Meta[] = []; export { schemeMeta }; -const internalColorSchemes: ColorScheme[] = []; -export { internalColorSchemes }; +const staffColorSchemes: ColorScheme[] = []; +export { staffColorSchemes }; const experimentalColorSchemes: ColorScheme[] = []; export { experimentalColorSchemes }; @@ -37,12 +37,8 @@ function fillColorSchemes(themesPath: string, colorSchemes: ColorScheme[]) { fillColorSchemes(themes_directory, colorSchemes); fillColorSchemes( - path.resolve(`${themes_directory}/internal`), - internalColorSchemes -); -fillColorSchemes( - path.resolve(`${themes_directory}/experiments`), - experimentalColorSchemes + path.resolve(`${themes_directory}/staff`), + staffColorSchemes ); function fillMeta(themesPath: string, meta: Meta[]) { diff --git a/styles/src/themes/experiments/.gitkeep b/styles/src/themes/experiments/.gitkeep deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/styles/src/themes/internal/.gitkeep b/styles/src/themes/internal/.gitkeep deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/assets/keymaps/experiments/.gitkeep b/styles/src/themes/staff/.gitkeep similarity index 100% rename from assets/keymaps/experiments/.gitkeep rename to styles/src/themes/staff/.gitkeep diff --git a/styles/src/themes/experiments/abruzzo.ts b/styles/src/themes/staff/abruzzo.ts similarity index 100% rename from styles/src/themes/experiments/abruzzo.ts rename to styles/src/themes/staff/abruzzo.ts diff --git a/styles/src/themes/internal/atelier-dune.ts b/styles/src/themes/staff/atelier-dune.ts similarity index 100% rename from styles/src/themes/internal/atelier-dune.ts rename to styles/src/themes/staff/atelier-dune.ts diff --git a/styles/src/themes/internal/atelier-heath.ts b/styles/src/themes/staff/atelier-heath.ts similarity index 100% rename from styles/src/themes/internal/atelier-heath.ts rename to styles/src/themes/staff/atelier-heath.ts diff --git a/styles/src/themes/internal/atelier-seaside.ts b/styles/src/themes/staff/atelier-seaside.ts similarity index 100% rename from styles/src/themes/internal/atelier-seaside.ts rename to styles/src/themes/staff/atelier-seaside.ts diff --git a/styles/src/themes/internal/ayu-mirage.ts b/styles/src/themes/staff/ayu-mirage.ts similarity index 100% rename from styles/src/themes/internal/ayu-mirage.ts rename to styles/src/themes/staff/ayu-mirage.ts diff --git a/styles/src/themes/internal/ayu.ts b/styles/src/themes/staff/ayu.ts similarity index 100% rename from styles/src/themes/internal/ayu.ts rename to styles/src/themes/staff/ayu.ts diff --git a/styles/src/themes/experiments/brushtrees.ts b/styles/src/themes/staff/brushtrees.ts similarity index 100% rename from styles/src/themes/experiments/brushtrees.ts rename to styles/src/themes/staff/brushtrees.ts diff --git a/styles/src/themes/internal/dracula.ts b/styles/src/themes/staff/dracula.ts similarity index 100% rename from styles/src/themes/internal/dracula.ts rename to styles/src/themes/staff/dracula.ts diff --git a/styles/src/themes/internal/gruvbox-medium.ts b/styles/src/themes/staff/gruvbox-medium.ts similarity index 100% rename from styles/src/themes/internal/gruvbox-medium.ts rename to styles/src/themes/staff/gruvbox-medium.ts diff --git a/styles/src/themes/internal/monokai.ts b/styles/src/themes/staff/monokai.ts similarity index 100% rename from styles/src/themes/internal/monokai.ts rename to styles/src/themes/staff/monokai.ts diff --git a/styles/src/themes/internal/nord.ts b/styles/src/themes/staff/nord.ts similarity index 100% rename from styles/src/themes/internal/nord.ts rename to styles/src/themes/staff/nord.ts diff --git a/styles/src/themes/internal/seti-ui.ts b/styles/src/themes/staff/seti-ui.ts similarity index 100% rename from styles/src/themes/internal/seti-ui.ts rename to styles/src/themes/staff/seti-ui.ts diff --git a/styles/src/themes/internal/tokyo-night-storm.ts b/styles/src/themes/staff/tokyo-night-storm.ts similarity index 100% rename from styles/src/themes/internal/tokyo-night-storm.ts rename to styles/src/themes/staff/tokyo-night-storm.ts diff --git a/styles/src/themes/internal/tokyo-night.ts b/styles/src/themes/staff/tokyo-night.ts similarity index 100% rename from styles/src/themes/internal/tokyo-night.ts rename to styles/src/themes/staff/tokyo-night.ts diff --git a/styles/src/themes/internal/zed-pro.ts b/styles/src/themes/staff/zed-pro.ts similarity index 100% rename from styles/src/themes/internal/zed-pro.ts rename to styles/src/themes/staff/zed-pro.ts diff --git a/styles/src/themes/internal/zenburn.ts b/styles/src/themes/staff/zenburn.ts similarity index 100% rename from styles/src/themes/internal/zenburn.ts rename to styles/src/themes/staff/zenburn.ts