diff --git a/Cargo.lock b/Cargo.lock index 609edba3ec57bbba341799afbfecbcbf22b1181a..a2ab191e59160fb257fcd70bbf6c3cbe0c628fbb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -14524,6 +14524,7 @@ dependencies = [ "settings", "theme", "ui", + "util", "workspace", "workspace-hack", "zlog", diff --git a/crates/settings/src/settings_store.rs b/crates/settings/src/settings_store.rs index 0f7f466b08c10b6402938301dc19e8a4616bc4e8..27ca294adde582a8580b83af207dc17d8e00d2c2 100644 --- a/crates/settings/src/settings_store.rs +++ b/crates/settings/src/settings_store.rs @@ -164,7 +164,7 @@ pub enum SettingsFile { Extension, Server, Default, - Local((WorktreeId, Arc)), + Local((WorktreeId, Arc)), } #[derive(Clone)] diff --git a/crates/settings_ui/Cargo.toml b/crates/settings_ui/Cargo.toml index 00e79567ba863a3fbe3440f58cb3ee48ea088db2..53300f71e49f535638caf2c2152f9b6552ea882d 100644 --- a/crates/settings_ui/Cargo.toml +++ b/crates/settings_ui/Cargo.toml @@ -28,6 +28,7 @@ serde.workspace = true settings.workspace = true theme.workspace = true ui.workspace = true +util.workspace = true workspace-hack.workspace = true workspace.workspace = true diff --git a/crates/settings_ui/src/settings_ui.rs b/crates/settings_ui/src/settings_ui.rs index d13dd5cd50378a66d03a7a403fe20bd68b7850f5..680d46bdcfea85d906c4849c4dc0a7fdda664a3b 100644 --- a/crates/settings_ui/src/settings_ui.rs +++ b/crates/settings_ui/src/settings_ui.rs @@ -9,13 +9,13 @@ use gpui::{ }; use project::WorktreeId; use settings::{SettingsContent, SettingsStore}; -use std::path::Path; use ui::{ ActiveTheme as _, AnyElement, BorrowAppContext as _, Button, Clickable as _, Color, FluentBuilder as _, Icon, IconName, InteractiveElement as _, Label, LabelCommon as _, LabelSize, ParentElement, SharedString, StatefulInteractiveElement as _, Styled, Switch, v_flex, }; +use util::{paths::PathStyle, rel_path::RelPath}; fn user_settings_data() -> Vec { vec![ @@ -84,7 +84,7 @@ fn project_settings_data() -> Vec { "project_name", SettingsFile::Local(( WorktreeId::from_usize(0), - Arc::from(Path::new("TODO: actually pass through file")), + Arc::from(RelPath::new("TODO: actually pass through file").unwrap()), )), window, cx, @@ -202,9 +202,9 @@ struct SettingItem { #[allow(unused)] #[derive(Clone, PartialEq)] enum SettingsFile { - User, // Uses all settings. - Local((WorktreeId, Arc)), // Has a special name, and special set of settings - Server(&'static str), // Uses a special name, and the user settings + User, // Uses all settings. + Local((WorktreeId, Arc)), // Has a special name, and special set of settings + Server(&'static str), // Uses a special name, and the user settings } impl SettingsFile { @@ -219,7 +219,10 @@ impl SettingsFile { fn name(&self) -> SharedString { match self { SettingsFile::User => SharedString::new_static("User"), - SettingsFile::Local((_, path)) => format!("Local ({})", path.display()).into(), + // TODO is PathStyle::local() ever not appropriate? + SettingsFile::Local((_, path)) => { + format!("Local ({})", path.display(PathStyle::local())).into() + } SettingsFile::Server(file) => format!("Server ({})", file).into(), } }