From d26f76ba90d5ca314fea8d63d1f0ccf1b1f92905 Mon Sep 17 00:00:00 2001 From: Mikayla Maki Date: Thu, 13 Jul 2023 16:56:39 -0700 Subject: [PATCH 01/11] Add suffix based file icons --- crates/language/src/language.rs | 19 ++++++++++ crates/project/src/project.rs | 5 +++ crates/project_panel/src/project_panel.rs | 45 +++++++++++++++++------ crates/theme/src/theme.rs | 3 +- crates/zed/src/languages/toml/config.toml | 1 + styles/src/style_tree/project_panel.ts | 3 +- 6 files changed, 62 insertions(+), 14 deletions(-) diff --git a/crates/language/src/language.rs b/crates/language/src/language.rs index 50a0b4b161..f416422fa2 100644 --- a/crates/language/src/language.rs +++ b/crates/language/src/language.rs @@ -342,6 +342,8 @@ pub struct LanguageConfig { pub block_comment: Option<(Arc, Arc)>, #[serde(default)] pub overrides: HashMap, + #[serde(default)] + pub icon_path: Option>, } #[derive(Debug, Default)] @@ -408,6 +410,7 @@ impl Default for LanguageConfig { line_comment: Default::default(), block_comment: Default::default(), overrides: Default::default(), + icon_path: Default::default(), } } } @@ -752,6 +755,22 @@ impl LanguageRegistry { self.get_or_load_language(|config| UniCase::new(config.name.as_ref()) == name) } + pub fn icon_for_suffix( + self: &Arc, + suffix: &str, + ) -> Option> { + let state = self.state.read(); + state.available_languages + .iter() + .find(|langauge| { + langauge.config.path_suffixes.iter().any(|s| s == suffix) + }) + .map(|language| { + language.config.icon_path.clone() + }) + .flatten() + } + pub fn language_for_name_or_extension( self: &Arc, string: &str, diff --git a/crates/project/src/project.rs b/crates/project/src/project.rs index 5bb8af3f38..1158f2fa56 100644 --- a/crates/project/src/project.rs +++ b/crates/project/src/project.rs @@ -2474,6 +2474,11 @@ impl Project { }) } + pub fn icon_for_path(&self, path: &Path) -> Option> { + self.languages + .icon_for_suffix(path.extension()?.to_str()?) + } + fn detect_language_for_buffer( &mut self, buffer_handle: &ModelHandle, diff --git a/crates/project_panel/src/project_panel.rs b/crates/project_panel/src/project_panel.rs index 5442a8be74..ce86b1e768 100644 --- a/crates/project_panel/src/project_panel.rs +++ b/crates/project_panel/src/project_panel.rs @@ -44,6 +44,7 @@ use workspace::{ const PROJECT_PANEL_KEY: &'static str = "ProjectPanel"; const NEW_ENTRY_ID: ProjectEntryId = ProjectEntryId::MAX; +const TEXT_FILE_ASSET: &'static str = "icons/radix/file-text.svg"; pub struct ProjectPanel { project: ModelHandle, @@ -94,6 +95,7 @@ pub enum ClipboardEntry { #[derive(Debug, PartialEq, Eq)] pub struct EntryDetails { filename: String, + icon: Option>, path: Arc, depth: usize, kind: EntryKind, @@ -1180,6 +1182,15 @@ impl ProjectPanel { for entry in visible_worktree_entries[entry_range].iter() { let status = git_status_setting.then(|| entry.git_status).flatten(); + let icon = match entry.kind { + EntryKind::File(_) => self + .project + .read(cx) + .icon_for_path(&entry.path) + .or_else(|| Some(TEXT_FILE_ASSET.into())), + _ => None, + }; + let mut details = EntryDetails { filename: entry .path @@ -1187,6 +1198,7 @@ impl ProjectPanel { .unwrap_or(root_name) .to_string_lossy() .to_string(), + icon, path: entry.path.clone(), depth: entry.path.components().count(), kind: entry.kind, @@ -1254,23 +1266,32 @@ impl ProjectPanel { .unwrap_or(style.text.color); Flex::row() - .with_child( - if kind.is_dir() { - if details.is_expanded { - Svg::new("icons/chevron_down_8.svg").with_color(style.icon_color) - } else { - Svg::new("icons/chevron_right_8.svg").with_color(style.icon_color) - } - .constrained() + .with_child(if kind.is_dir() { + if details.is_expanded { + Svg::new("icons/chevron_down_8.svg").with_color(style.icon_color) + } else { + Svg::new("icons/chevron_right_8.svg").with_color(style.icon_color) + } + .constrained() + .with_max_width(style.directory_icon_size) + .with_max_height(style.directory_icon_size) + .aligned() + .constrained() + .with_width(style.directory_icon_size) + } else { + if let Some(icon) = &details.icon { + Svg::new(icon.to_string()) + .with_color(style.icon_color) + .constrained() } else { Empty::new().constrained() } - .with_max_width(style.icon_size) - .with_max_height(style.icon_size) + .with_max_width(style.file_icon_size) + .with_max_height(style.file_icon_size) .aligned() .constrained() - .with_width(style.icon_size), - ) + .with_width(style.file_icon_size) + }) .with_child(if show_editor && editor.is_some() { ChildView::new(editor.as_ref().unwrap(), cx) .contained() diff --git a/crates/theme/src/theme.rs b/crates/theme/src/theme.rs index b7a7408bef..53a0629198 100644 --- a/crates/theme/src/theme.rs +++ b/crates/theme/src/theme.rs @@ -481,7 +481,8 @@ pub struct ProjectPanelEntry { pub container: ContainerStyle, pub text: TextStyle, pub icon_color: Color, - pub icon_size: f32, + pub directory_icon_size: f32, + pub file_icon_size: f32, pub icon_spacing: f32, pub status: EntryStatus, } diff --git a/crates/zed/src/languages/toml/config.toml b/crates/zed/src/languages/toml/config.toml index 4e89f5cabd..5a3fc9d8b8 100644 --- a/crates/zed/src/languages/toml/config.toml +++ b/crates/zed/src/languages/toml/config.toml @@ -1,5 +1,6 @@ name = "TOML" path_suffixes = ["toml"] +icon_path = "icons/radix/gear.svg" line_comment = "# " autoclose_before = ",]}" brackets = [ diff --git a/styles/src/style_tree/project_panel.ts b/styles/src/style_tree/project_panel.ts index af997d0a6e..c2719e935e 100644 --- a/styles/src/style_tree/project_panel.ts +++ b/styles/src/style_tree/project_panel.ts @@ -47,7 +47,8 @@ export default function project_panel(): any { height: 22, background: background(theme.middle), icon_color: foreground(theme.middle, "variant"), - icon_size: 7, + directory_icon_size: 7, + file_icon_size: 14, icon_spacing: 5, text: text(theme.middle, "sans", "variant", { size: "sm" }), status: { From d023189bda9d13a463980830ff352d1e445b1702 Mon Sep 17 00:00:00 2001 From: Mikayla Maki Date: Thu, 13 Jul 2023 17:02:19 -0700 Subject: [PATCH 02/11] Add settings --- assets/settings/default.json | 2 + crates/language/src/language.rs | 16 +++----- crates/project/src/project.rs | 3 +- crates/project_panel/src/project_panel.rs | 41 ++++++++++++------- .../src/project_panel_settings.rs | 2 + 5 files changed, 36 insertions(+), 28 deletions(-) diff --git a/assets/settings/default.json b/assets/settings/default.json index 5cf5f59f76..e1f2d93270 100644 --- a/assets/settings/default.json +++ b/assets/settings/default.json @@ -99,6 +99,8 @@ "project_panel": { // Whether to show the git status in the project panel. "git_status": true, + // Whether to show file icons in the project panel. + "file_icons": true, // Where to dock project panel. Can be 'left' or 'right'. "dock": "left", // Default width of the project panel. diff --git a/crates/language/src/language.rs b/crates/language/src/language.rs index f416422fa2..60f14d9fa7 100644 --- a/crates/language/src/language.rs +++ b/crates/language/src/language.rs @@ -755,19 +755,13 @@ impl LanguageRegistry { self.get_or_load_language(|config| UniCase::new(config.name.as_ref()) == name) } - pub fn icon_for_suffix( - self: &Arc, - suffix: &str, - ) -> Option> { + pub fn icon_for_suffix(self: &Arc, suffix: &str) -> Option> { let state = self.state.read(); - state.available_languages + state + .available_languages .iter() - .find(|langauge| { - langauge.config.path_suffixes.iter().any(|s| s == suffix) - }) - .map(|language| { - language.config.icon_path.clone() - }) + .find(|langauge| langauge.config.path_suffixes.iter().any(|s| s == suffix)) + .map(|language| language.config.icon_path.clone()) .flatten() } diff --git a/crates/project/src/project.rs b/crates/project/src/project.rs index 1158f2fa56..80c098baa6 100644 --- a/crates/project/src/project.rs +++ b/crates/project/src/project.rs @@ -2475,8 +2475,7 @@ impl Project { } pub fn icon_for_path(&self, path: &Path) -> Option> { - self.languages - .icon_for_suffix(path.extension()?.to_str()?) + self.languages.icon_for_suffix(path.extension()?.to_str()?) } fn detect_language_for_buffer( diff --git a/crates/project_panel/src/project_panel.rs b/crates/project_panel/src/project_panel.rs index ce86b1e768..06c6c1540c 100644 --- a/crates/project_panel/src/project_panel.rs +++ b/crates/project_panel/src/project_panel.rs @@ -1168,7 +1168,10 @@ impl ProjectPanel { } let end_ix = range.end.min(ix + visible_worktree_entries.len()); - let git_status_setting = settings::get::(cx).git_status; + let (git_status_setting, show_file_icons) = { + let settings = settings::get::(cx); + (settings.git_status, settings.file_icons) + }; if let Some(worktree) = self.project.read(cx).worktree_for_id(*worktree_id, cx) { let snapshot = worktree.read(cx).snapshot(); let root_name = OsStr::new(snapshot.root_name()); @@ -1182,14 +1185,16 @@ impl ProjectPanel { for entry in visible_worktree_entries[entry_range].iter() { let status = git_status_setting.then(|| entry.git_status).flatten(); - let icon = match entry.kind { - EntryKind::File(_) => self - .project - .read(cx) - .icon_for_path(&entry.path) - .or_else(|| Some(TEXT_FILE_ASSET.into())), - _ => None, - }; + let icon = show_file_icons + .then(|| match entry.kind { + EntryKind::File(_) => self + .project + .read(cx) + .icon_for_path(&entry.path) + .or_else(|| Some(TEXT_FILE_ASSET.into())), + _ => None, + }) + .flatten(); let mut details = EntryDetails { filename: entry @@ -1283,14 +1288,20 @@ impl ProjectPanel { Svg::new(icon.to_string()) .with_color(style.icon_color) .constrained() + .with_max_width(style.file_icon_size) + .with_max_height(style.file_icon_size) + .aligned() + .constrained() + .with_width(style.file_icon_size) } else { - Empty::new().constrained() + Empty::new() + .constrained() + .with_max_width(style.directory_icon_size) + .with_max_height(style.directory_icon_size) + .aligned() + .constrained() + .with_width(style.directory_icon_size) } - .with_max_width(style.file_icon_size) - .with_max_height(style.file_icon_size) - .aligned() - .constrained() - .with_width(style.file_icon_size) }) .with_child(if show_editor && editor.is_some() { ChildView::new(editor.as_ref().unwrap(), cx) diff --git a/crates/project_panel/src/project_panel_settings.rs b/crates/project_panel/src/project_panel_settings.rs index 1d6c590710..f0d60d7f4f 100644 --- a/crates/project_panel/src/project_panel_settings.rs +++ b/crates/project_panel/src/project_panel_settings.rs @@ -13,6 +13,7 @@ pub enum ProjectPanelDockPosition { #[derive(Deserialize, Debug)] pub struct ProjectPanelSettings { pub git_status: bool, + pub file_icons: bool, pub dock: ProjectPanelDockPosition, pub default_width: f32, } @@ -20,6 +21,7 @@ pub struct ProjectPanelSettings { #[derive(Clone, Default, Serialize, Deserialize, JsonSchema, Debug)] pub struct ProjectPanelSettingsContent { pub git_status: Option, + pub file_icons: Option, pub dock: Option, pub default_width: Option, } From fd72f4526d7398df009172d786280c1572c71328 Mon Sep 17 00:00:00 2001 From: Mikayla Maki Date: Thu, 13 Jul 2023 20:46:24 -0700 Subject: [PATCH 03/11] Added file suffix and icon associations data --- Cargo.lock | 1 + assets/icons/file_icons/file_types.json | 107 ++++++++++++++++++ assets/icons/file_icons/quill/anchor.svg | 11 ++ assets/icons/file_icons/quill/archive.svg | 12 ++ assets/icons/file_icons/quill/book.svg | 11 ++ assets/icons/file_icons/quill/camera.svg | 12 ++ assets/icons/file_icons/quill/code.svg | 12 ++ assets/icons/file_icons/quill/database.svg | 11 ++ assets/icons/file_icons/quill/eslint.svg | 10 ++ assets/icons/file_icons/quill/file.svg | 11 ++ assets/icons/file_icons/quill/folder-open.svg | 12 ++ assets/icons/file_icons/quill/folder.svg | 11 ++ assets/icons/file_icons/quill/git.svg | 11 ++ assets/icons/file_icons/quill/hash.svg | 11 ++ assets/icons/file_icons/quill/html.svg | 12 ++ assets/icons/file_icons/quill/image.svg | 12 ++ assets/icons/file_icons/quill/info.svg | 12 ++ assets/icons/file_icons/quill/lock.svg | 11 ++ assets/icons/file_icons/quill/package.svg | 11 ++ assets/icons/file_icons/quill/prettier.svg | 22 ++++ assets/icons/file_icons/quill/settings.svg | 11 ++ assets/icons/file_icons/quill/terminal.svg | 9 ++ crates/language/src/language.rs | 13 --- crates/project/src/project.rs | 4 - crates/project_panel/Cargo.toml | 1 + crates/project_panel/src/file_associations.rs | 64 +++++++++++ crates/project_panel/src/project_panel.rs | 71 ++++++------ crates/theme/src/theme.rs | 5 +- crates/zed/src/languages/toml/config.toml | 1 - crates/zed/src/main.rs | 2 +- crates/zed/src/zed.rs | 2 +- styles/src/style_tree/project_panel.ts | 7 +- 32 files changed, 451 insertions(+), 62 deletions(-) create mode 100644 assets/icons/file_icons/file_types.json create mode 100644 assets/icons/file_icons/quill/anchor.svg create mode 100644 assets/icons/file_icons/quill/archive.svg create mode 100644 assets/icons/file_icons/quill/book.svg create mode 100644 assets/icons/file_icons/quill/camera.svg create mode 100644 assets/icons/file_icons/quill/code.svg create mode 100644 assets/icons/file_icons/quill/database.svg create mode 100644 assets/icons/file_icons/quill/eslint.svg create mode 100644 assets/icons/file_icons/quill/file.svg create mode 100644 assets/icons/file_icons/quill/folder-open.svg create mode 100644 assets/icons/file_icons/quill/folder.svg create mode 100644 assets/icons/file_icons/quill/git.svg create mode 100644 assets/icons/file_icons/quill/hash.svg create mode 100644 assets/icons/file_icons/quill/html.svg create mode 100644 assets/icons/file_icons/quill/image.svg create mode 100644 assets/icons/file_icons/quill/info.svg create mode 100644 assets/icons/file_icons/quill/lock.svg create mode 100644 assets/icons/file_icons/quill/package.svg create mode 100644 assets/icons/file_icons/quill/prettier.svg create mode 100644 assets/icons/file_icons/quill/settings.svg create mode 100644 assets/icons/file_icons/quill/terminal.svg create mode 100644 crates/project_panel/src/file_associations.rs diff --git a/Cargo.lock b/Cargo.lock index dca182a38f..fd99fe7ef7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5360,6 +5360,7 @@ version = "0.1.0" dependencies = [ "anyhow", "client", + "collections", "context_menu", "db", "drag_and_drop", diff --git a/assets/icons/file_icons/file_types.json b/assets/icons/file_icons/file_types.json new file mode 100644 index 0000000000..8803647857 --- /dev/null +++ b/assets/icons/file_icons/file_types.json @@ -0,0 +1,107 @@ +{ + "suffixes": { + "jpg": "image", + "jpeg": "image", + "tiff": "image", + "svg": "image", + "psd": "image", + "png": "image", + "gif": "image", + "bmp": "image", + "ico": "image", + "mp4": "video", + "webm": "video", + "ogg": "video", + "mp3": "audio", + "wav": "audio", + "flac": "audio", + "aac": "audio", + "pdf": "document", + "doc": "document", + "docx": "document", + "xls": "document", + "xlsx": "document", + "ppt": "document", + "pptx": "document", + "odt": "document", + "ods": "document", + "odp": "document", + "txt": "document", + "rtf": "document", + "md": "document", + "html": "template", + "htm": "template", + "xml": "template", + "hbs": "template", + "handlebars": "template", + "js": "code", + "css": "code", + "php": "code", + "c": "code", + "cpp": "code", + "h": "code", + "hpp": "code", + "java": "code", + "py": "code", + "swift": "code", + "go": "code", + "rb": "code", + "rs": "code", + "rkt": "code", + "scm": "code", + "sql": "code", + "json": "settings", + "ini": "settings", + "yaml": "settings", + "yml": "settings", + "toml": "settings", + "conf": "settings", + "lock": "settings", + "gitignore": "vcs", + "gitattributes": "vcs", + "ps1": "terminal", + "sh": "terminal", + "bash": "terminal", + "zsh": "terminal", + "fish": "terminal", + "log": "log" + }, + "types": { + "directory": { + "icon": "icons/file_icons/quill/folder.svg" + }, + "expanded_directory": { + "icon": "icons/file_icons/quill/folder-open.svg" + }, + "image": { + "icon": "icons/file_icons/quill/image.svg" + }, + "video": { + "icon": "icons/file_icons/quill/file.svg" + }, + "audio": { + "icon": "icons/file_icons/quill/file.svg" + }, + "document": { + "icon": "icons/file_icons/quill/book.svg" + }, + "template": { + "icon": "icons/file_icons/quill/html.svg" + }, + "code": { + "icon": "icons/file_icons/quill/code.svg" + }, + "settings": { + "icon": "icons/file_icons/quill/settings.svg" + }, + "vcs": { + "icon": "icons/file_icons/quill/git.svg" + }, + "terminal": { + "icon": "icons/file_icons/quill/terminal.svg" + }, + "log": { + "icon": "icons/file_icons/quill/info.svg" + } + } +} diff --git a/assets/icons/file_icons/quill/anchor.svg b/assets/icons/file_icons/quill/anchor.svg new file mode 100644 index 0000000000..4828578ee0 --- /dev/null +++ b/assets/icons/file_icons/quill/anchor.svg @@ -0,0 +1,11 @@ + + + + anchor_dark + Created with Sketch. + + + + + + \ No newline at end of file diff --git a/assets/icons/file_icons/quill/archive.svg b/assets/icons/file_icons/quill/archive.svg new file mode 100644 index 0000000000..c78ca0cff6 --- /dev/null +++ b/assets/icons/file_icons/quill/archive.svg @@ -0,0 +1,12 @@ + + + + archive_dark + Created with Sketch. + + + + + + + \ No newline at end of file diff --git a/assets/icons/file_icons/quill/book.svg b/assets/icons/file_icons/quill/book.svg new file mode 100644 index 0000000000..af918b5c61 --- /dev/null +++ b/assets/icons/file_icons/quill/book.svg @@ -0,0 +1,11 @@ + + + + book_dark + Created with Sketch. + + + + + + \ No newline at end of file diff --git a/assets/icons/file_icons/quill/camera.svg b/assets/icons/file_icons/quill/camera.svg new file mode 100644 index 0000000000..f861af607c --- /dev/null +++ b/assets/icons/file_icons/quill/camera.svg @@ -0,0 +1,12 @@ + + + + camera_dark + Created with Sketch. + + + + + + + \ No newline at end of file diff --git a/assets/icons/file_icons/quill/code.svg b/assets/icons/file_icons/quill/code.svg new file mode 100644 index 0000000000..a844740f1a --- /dev/null +++ b/assets/icons/file_icons/quill/code.svg @@ -0,0 +1,12 @@ + + + + code_dark + Created with Sketch. + + + + + + + \ No newline at end of file diff --git a/assets/icons/file_icons/quill/database.svg b/assets/icons/file_icons/quill/database.svg new file mode 100644 index 0000000000..8c98d5ac16 --- /dev/null +++ b/assets/icons/file_icons/quill/database.svg @@ -0,0 +1,11 @@ + + + + database_dark + Created with Sketch. + + + + + + \ No newline at end of file diff --git a/assets/icons/file_icons/quill/eslint.svg b/assets/icons/file_icons/quill/eslint.svg new file mode 100644 index 0000000000..880689293a --- /dev/null +++ b/assets/icons/file_icons/quill/eslint.svg @@ -0,0 +1,10 @@ + + + + eslint_dark + Created with Sketch. + + + + + \ No newline at end of file diff --git a/assets/icons/file_icons/quill/file.svg b/assets/icons/file_icons/quill/file.svg new file mode 100644 index 0000000000..492c383ab6 --- /dev/null +++ b/assets/icons/file_icons/quill/file.svg @@ -0,0 +1,11 @@ + + + + file_dark + Created with Sketch. + + + + + + \ No newline at end of file diff --git a/assets/icons/file_icons/quill/folder-open.svg b/assets/icons/file_icons/quill/folder-open.svg new file mode 100644 index 0000000000..00a94c199f --- /dev/null +++ b/assets/icons/file_icons/quill/folder-open.svg @@ -0,0 +1,12 @@ + + + + folder-open_dark + Created with Sketch. + + + + + + + \ No newline at end of file diff --git a/assets/icons/file_icons/quill/folder.svg b/assets/icons/file_icons/quill/folder.svg new file mode 100644 index 0000000000..9cc5b4a8c9 --- /dev/null +++ b/assets/icons/file_icons/quill/folder.svg @@ -0,0 +1,11 @@ + + + + folder_dark + Created with Sketch. + + + + + + \ No newline at end of file diff --git a/assets/icons/file_icons/quill/git.svg b/assets/icons/file_icons/quill/git.svg new file mode 100644 index 0000000000..830a7f9565 --- /dev/null +++ b/assets/icons/file_icons/quill/git.svg @@ -0,0 +1,11 @@ + + + + git_dark + Created with Sketch. + + + + + + \ No newline at end of file diff --git a/assets/icons/file_icons/quill/hash.svg b/assets/icons/file_icons/quill/hash.svg new file mode 100644 index 0000000000..36366625fe --- /dev/null +++ b/assets/icons/file_icons/quill/hash.svg @@ -0,0 +1,11 @@ + + + + hash_dark + Created with Sketch. + + + + + + \ No newline at end of file diff --git a/assets/icons/file_icons/quill/html.svg b/assets/icons/file_icons/quill/html.svg new file mode 100644 index 0000000000..7704575f24 --- /dev/null +++ b/assets/icons/file_icons/quill/html.svg @@ -0,0 +1,12 @@ + + + + html_dark + Created with Sketch. + + + + + + + \ No newline at end of file diff --git a/assets/icons/file_icons/quill/image.svg b/assets/icons/file_icons/quill/image.svg new file mode 100644 index 0000000000..0ec9583edd --- /dev/null +++ b/assets/icons/file_icons/quill/image.svg @@ -0,0 +1,12 @@ + + + + image_dark + Created with Sketch. + + + + + + + \ No newline at end of file diff --git a/assets/icons/file_icons/quill/info.svg b/assets/icons/file_icons/quill/info.svg new file mode 100644 index 0000000000..af3fa9d39d --- /dev/null +++ b/assets/icons/file_icons/quill/info.svg @@ -0,0 +1,12 @@ + + + + info_dark + Created with Sketch. + + + + + + + \ No newline at end of file diff --git a/assets/icons/file_icons/quill/lock.svg b/assets/icons/file_icons/quill/lock.svg new file mode 100644 index 0000000000..a1e36e6c12 --- /dev/null +++ b/assets/icons/file_icons/quill/lock.svg @@ -0,0 +1,11 @@ + + + + lock_dark + Created with Sketch. + + + + + + \ No newline at end of file diff --git a/assets/icons/file_icons/quill/package.svg b/assets/icons/file_icons/quill/package.svg new file mode 100644 index 0000000000..9bda169cf5 --- /dev/null +++ b/assets/icons/file_icons/quill/package.svg @@ -0,0 +1,11 @@ + + + + package_dark + Created with Sketch. + + + + + + \ No newline at end of file diff --git a/assets/icons/file_icons/quill/prettier.svg b/assets/icons/file_icons/quill/prettier.svg new file mode 100644 index 0000000000..ba7b340654 --- /dev/null +++ b/assets/icons/file_icons/quill/prettier.svg @@ -0,0 +1,22 @@ + + + + prettier_dark + Created with Sketch. + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/icons/file_icons/quill/settings.svg b/assets/icons/file_icons/quill/settings.svg new file mode 100644 index 0000000000..f0209bf3c2 --- /dev/null +++ b/assets/icons/file_icons/quill/settings.svg @@ -0,0 +1,11 @@ + + + + settings_dark + Created with Sketch. + + + + + + \ No newline at end of file diff --git a/assets/icons/file_icons/quill/terminal.svg b/assets/icons/file_icons/quill/terminal.svg new file mode 100644 index 0000000000..964f44251f --- /dev/null +++ b/assets/icons/file_icons/quill/terminal.svg @@ -0,0 +1,9 @@ + + + + terminal_dark + Created with Sketch. + + + + \ No newline at end of file diff --git a/crates/language/src/language.rs b/crates/language/src/language.rs index 60f14d9fa7..50a0b4b161 100644 --- a/crates/language/src/language.rs +++ b/crates/language/src/language.rs @@ -342,8 +342,6 @@ pub struct LanguageConfig { pub block_comment: Option<(Arc, Arc)>, #[serde(default)] pub overrides: HashMap, - #[serde(default)] - pub icon_path: Option>, } #[derive(Debug, Default)] @@ -410,7 +408,6 @@ impl Default for LanguageConfig { line_comment: Default::default(), block_comment: Default::default(), overrides: Default::default(), - icon_path: Default::default(), } } } @@ -755,16 +752,6 @@ impl LanguageRegistry { self.get_or_load_language(|config| UniCase::new(config.name.as_ref()) == name) } - pub fn icon_for_suffix(self: &Arc, suffix: &str) -> Option> { - let state = self.state.read(); - state - .available_languages - .iter() - .find(|langauge| langauge.config.path_suffixes.iter().any(|s| s == suffix)) - .map(|language| language.config.icon_path.clone()) - .flatten() - } - pub fn language_for_name_or_extension( self: &Arc, string: &str, diff --git a/crates/project/src/project.rs b/crates/project/src/project.rs index 80c098baa6..5bb8af3f38 100644 --- a/crates/project/src/project.rs +++ b/crates/project/src/project.rs @@ -2474,10 +2474,6 @@ impl Project { }) } - pub fn icon_for_path(&self, path: &Path) -> Option> { - self.languages.icon_for_suffix(path.extension()?.to_str()?) - } - fn detect_language_for_buffer( &mut self, buffer_handle: &ModelHandle, diff --git a/crates/project_panel/Cargo.toml b/crates/project_panel/Cargo.toml index 33606fccc4..4fe5372a51 100644 --- a/crates/project_panel/Cargo.toml +++ b/crates/project_panel/Cargo.toml @@ -10,6 +10,7 @@ doctest = false [dependencies] context_menu = { path = "../context_menu" } +collections = { path = "../collections" } db = { path = "../db" } drag_and_drop = { path = "../drag_and_drop" } editor = { path = "../editor" } diff --git a/crates/project_panel/src/file_associations.rs b/crates/project_panel/src/file_associations.rs new file mode 100644 index 0000000000..ea8e59685b --- /dev/null +++ b/crates/project_panel/src/file_associations.rs @@ -0,0 +1,64 @@ +use std::{path::Path, str, sync::Arc}; + +use collections::HashMap; + +use gpui::{AppContext, AssetSource}; +use serde_derive::Deserialize; + +#[derive(Deserialize, Debug)] +struct TypeConfig { + icon: Arc, +} + +#[derive(Deserialize, Debug)] +pub struct FileAssociations { + suffixes: HashMap, + types: HashMap, +} + +pub const TEXT_FILE_ASSET: &'static str = "icons/file_icons/quill/file.svg"; +const DIRECTORY_TYPE: &'static str = "directory"; +const EXPANDED_DIRECTORY_TYPE: &'static str = "expanded_directory"; + +pub fn init(assets: impl AssetSource, cx: &mut AppContext) { + cx.set_global(FileAssociations::new(assets)) +} + +impl FileAssociations { + pub fn new(assets: impl AssetSource) -> Self { + let file = assets.load("icons/file_icons/file_types.json").unwrap(); + serde_json::from_str::(str::from_utf8(&file).unwrap()).unwrap() + } + + pub fn get_icon(path: &Path, cx: &AppContext) -> Option> { + if !cx.has_global::() { + return None; + } + + let this = cx.global::(); + let suffix = path.extension()?.to_str()?; + + this.suffixes + .get(suffix) + .and_then(|type_str| this.types.get(type_str)) + .map(|type_config| type_config.icon.clone()) + } + + pub fn get_folder_icon(expanded: bool, cx: &AppContext) -> Option> { + if !cx.has_global::() { + return None; + } + + let this = cx.global::(); + + let key = if expanded { + EXPANDED_DIRECTORY_TYPE + } else { + DIRECTORY_TYPE + }; + + this.types + .get(key) + .map(|type_config| type_config.icon.clone()) + } +} diff --git a/crates/project_panel/src/project_panel.rs b/crates/project_panel/src/project_panel.rs index 06c6c1540c..dd40fdd561 100644 --- a/crates/project_panel/src/project_panel.rs +++ b/crates/project_panel/src/project_panel.rs @@ -1,9 +1,11 @@ +mod file_associations; mod project_panel_settings; use context_menu::{ContextMenu, ContextMenuItem}; use db::kvp::KEY_VALUE_STORE; use drag_and_drop::{DragAndDrop, Draggable}; use editor::{Cancel, Editor}; +use file_associations::{FileAssociations, TEXT_FILE_ASSET}; use futures::stream::StreamExt; use gpui::{ actions, @@ -15,8 +17,8 @@ use gpui::{ geometry::vector::Vector2F, keymap_matcher::KeymapContext, platform::{CursorStyle, MouseButton, PromptLevel}, - Action, AnyElement, AppContext, AsyncAppContext, ClipboardItem, Element, Entity, ModelHandle, - Task, View, ViewContext, ViewHandle, WeakViewHandle, WindowContext, + Action, AnyElement, AppContext, AssetSource, AsyncAppContext, ClipboardItem, Element, Entity, + ModelHandle, Task, View, ViewContext, ViewHandle, WeakViewHandle, WindowContext, }; use menu::{Confirm, SelectNext, SelectPrev}; use project::{ @@ -44,7 +46,6 @@ use workspace::{ const PROJECT_PANEL_KEY: &'static str = "ProjectPanel"; const NEW_ENTRY_ID: ProjectEntryId = ProjectEntryId::MAX; -const TEXT_FILE_ASSET: &'static str = "icons/radix/file-text.svg"; pub struct ProjectPanel { project: ModelHandle, @@ -131,8 +132,9 @@ pub fn init_settings(cx: &mut AppContext) { settings::register::(cx); } -pub fn init(cx: &mut AppContext) { +pub fn init(assets: impl AssetSource, cx: &mut AppContext) { init_settings(cx); + file_associations::init(assets, cx); cx.add_action(ProjectPanel::expand_selected_entry); cx.add_action(ProjectPanel::collapse_selected_entry); cx.add_action(ProjectPanel::select_prev); @@ -1184,15 +1186,12 @@ impl ProjectPanel { let entry_range = range.start.saturating_sub(ix)..end_ix - ix; for entry in visible_worktree_entries[entry_range].iter() { let status = git_status_setting.then(|| entry.git_status).flatten(); - + let is_expanded = expanded_entry_ids.binary_search(&entry.id).is_ok(); let icon = show_file_icons .then(|| match entry.kind { - EntryKind::File(_) => self - .project - .read(cx) - .icon_for_path(&entry.path) + EntryKind::File(_) => FileAssociations::get_icon(&entry.path, cx) .or_else(|| Some(TEXT_FILE_ASSET.into())), - _ => None, + _ => FileAssociations::get_folder_icon(is_expanded, cx), }) .flatten(); @@ -1208,7 +1207,7 @@ impl ProjectPanel { depth: entry.path.components().count(), kind: entry.kind, is_ignored: entry.is_ignored, - is_expanded: expanded_entry_ids.binary_search(&entry.id).is_ok(), + is_expanded, is_selected: self.selection.map_or(false, |e| { e.worktree_id == snapshot.id() && e.entry_id == entry.id }), @@ -1271,37 +1270,35 @@ impl ProjectPanel { .unwrap_or(style.text.color); Flex::row() - .with_child(if kind.is_dir() { + .with_child(if let Some(icon) = &details.icon { + Svg::new(icon.to_string()) + .with_color(style.icon_color) + .constrained() + .with_max_width(style.icon_size) + .with_max_height(style.icon_size) + .aligned() + .constrained() + .with_width(style.icon_size) + } else if kind.is_dir() { if details.is_expanded { - Svg::new("icons/chevron_down_8.svg").with_color(style.icon_color) + Svg::new("icons/chevron_down_8.svg").with_color(style.chevron_color) } else { - Svg::new("icons/chevron_right_8.svg").with_color(style.icon_color) + Svg::new("icons/chevron_right_8.svg").with_color(style.chevron_color) } .constrained() - .with_max_width(style.directory_icon_size) - .with_max_height(style.directory_icon_size) + .with_max_width(style.chevron_size) + .with_max_height(style.chevron_size) .aligned() .constrained() - .with_width(style.directory_icon_size) + .with_width(style.chevron_size) } else { - if let Some(icon) = &details.icon { - Svg::new(icon.to_string()) - .with_color(style.icon_color) - .constrained() - .with_max_width(style.file_icon_size) - .with_max_height(style.file_icon_size) - .aligned() - .constrained() - .with_width(style.file_icon_size) - } else { - Empty::new() - .constrained() - .with_max_width(style.directory_icon_size) - .with_max_height(style.directory_icon_size) - .aligned() - .constrained() - .with_width(style.directory_icon_size) - } + Empty::new() + .constrained() + .with_max_width(style.chevron_size) + .with_max_height(style.chevron_size) + .aligned() + .constrained() + .with_width(style.chevron_size) }) .with_child(if show_editor && editor.is_some() { ChildView::new(editor.as_ref().unwrap(), cx) @@ -2613,7 +2610,7 @@ mod tests { theme::init((), cx); language::init(cx); editor::init_settings(cx); - crate::init(cx); + crate::init((), cx); workspace::init_settings(cx); Project::init_settings(cx); }); @@ -2628,7 +2625,7 @@ mod tests { language::init(cx); editor::init(cx); pane::init(cx); - crate::init(cx); + crate::init((), cx); workspace::init(app_state.clone(), cx); Project::init_settings(cx); }); diff --git a/crates/theme/src/theme.rs b/crates/theme/src/theme.rs index 53a0629198..29c0d9ce8e 100644 --- a/crates/theme/src/theme.rs +++ b/crates/theme/src/theme.rs @@ -480,9 +480,10 @@ pub struct ProjectPanelEntry { #[serde(flatten)] pub container: ContainerStyle, pub text: TextStyle, + pub icon_size: f32, pub icon_color: Color, - pub directory_icon_size: f32, - pub file_icon_size: f32, + pub chevron_color: Color, + pub chevron_size: f32, pub icon_spacing: f32, pub status: EntryStatus, } diff --git a/crates/zed/src/languages/toml/config.toml b/crates/zed/src/languages/toml/config.toml index 5a3fc9d8b8..4e89f5cabd 100644 --- a/crates/zed/src/languages/toml/config.toml +++ b/crates/zed/src/languages/toml/config.toml @@ -1,6 +1,5 @@ name = "TOML" path_suffixes = ["toml"] -icon_path = "icons/radix/gear.svg" line_comment = "# " autoclose_before = ",]}" brackets = [ diff --git a/crates/zed/src/main.rs b/crates/zed/src/main.rs index ccf381b5b1..e85113d57d 100644 --- a/crates/zed/src/main.rs +++ b/crates/zed/src/main.rs @@ -154,7 +154,7 @@ fn main() { file_finder::init(cx); outline::init(cx); project_symbols::init(cx); - project_panel::init(cx); + project_panel::init(Assets, cx); diagnostics::init(cx); search::init(cx); vector_store::init(fs.clone(), http.clone(), languages.clone(), cx); diff --git a/crates/zed/src/zed.rs b/crates/zed/src/zed.rs index 9dffc644ae..6bbba0bd02 100644 --- a/crates/zed/src/zed.rs +++ b/crates/zed/src/zed.rs @@ -2334,7 +2334,7 @@ mod tests { editor::init(cx); project_panel::init_settings(cx); pane::init(cx); - project_panel::init(cx); + project_panel::init((), cx); terminal_view::init(cx); ai::init(cx); app_state diff --git a/styles/src/style_tree/project_panel.ts b/styles/src/style_tree/project_panel.ts index c2719e935e..c3e82de8b0 100644 --- a/styles/src/style_tree/project_panel.ts +++ b/styles/src/style_tree/project_panel.ts @@ -46,9 +46,10 @@ export default function project_panel(): any { const base_properties = { height: 22, background: background(theme.middle), - icon_color: foreground(theme.middle, "variant"), - directory_icon_size: 7, - file_icon_size: 14, + chevron_color: foreground(theme.middle, "variant"), + icon_color: foreground(theme.middle, "active"), + chevron_size: 7, + icon_size: 14, icon_spacing: 5, text: text(theme.middle, "sans", "variant", { size: "sm" }), status: { From 929a9f97b28e0654ad8b9b942f34c66d2a4fd73b Mon Sep 17 00:00:00 2001 From: Mikayla Maki Date: Thu, 13 Jul 2023 20:58:26 -0700 Subject: [PATCH 04/11] Fix tests --- crates/project_panel/src/file_associations.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/crates/project_panel/src/file_associations.rs b/crates/project_panel/src/file_associations.rs index ea8e59685b..e1fb9b3c64 100644 --- a/crates/project_panel/src/file_associations.rs +++ b/crates/project_panel/src/file_associations.rs @@ -26,8 +26,15 @@ pub fn init(assets: impl AssetSource, cx: &mut AppContext) { impl FileAssociations { pub fn new(assets: impl AssetSource) -> Self { - let file = assets.load("icons/file_icons/file_types.json").unwrap(); - serde_json::from_str::(str::from_utf8(&file).unwrap()).unwrap() + assets + .load("icons/file_icons/file_types.json") + .map(|file| { + serde_json::from_str::(str::from_utf8(&file).unwrap()).unwrap() + }) + .unwrap_or_else(|_| FileAssociations { + suffixes: HashMap::default(), + types: HashMap::default(), + }) } pub fn get_icon(path: &Path, cx: &AppContext) -> Option> { From 96ef6ab3268e9827bdb87fe6bbe81a2990385e62 Mon Sep 17 00:00:00 2001 From: Mikayla Maki Date: Thu, 13 Jul 2023 21:04:47 -0700 Subject: [PATCH 05/11] Add willow license --- script/generate-licenses | 9 ++++++++- script/licenses/willow_license.txt | 21 +++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 script/licenses/willow_license.txt diff --git a/script/generate-licenses b/script/generate-licenses index 14c9d4c79f..b08aa0b024 100755 --- a/script/generate-licenses +++ b/script/generate-licenses @@ -6,6 +6,13 @@ OUTPUT_FILE=$(pwd)/assets/licenses.md > $OUTPUT_FILE +echo -e "# ###### ICON LICENSES ######\n" >> $OUTPUT_FILE + +echo "Generating icon licenses" + +cat script/licenses/willow_license.txt >> $OUTPUT_FILE +echo -e "" >> $OUTPUT_FILE + echo -e "# ###### THEME LICENSES ######\n" >> $OUTPUT_FILE echo "Generating theme licenses" @@ -26,4 +33,4 @@ sed -i '' 's/'/'\''/g' $OUTPUT_FILE # The ` '\'' ` thing ends the string, a sed -i '' 's/=/=/g' $OUTPUT_FILE sed -i '' 's/`/`/g' $OUTPUT_FILE sed -i '' 's/<//g' $OUTPUT_FILE \ No newline at end of file +sed -i '' 's/>/>/g' $OUTPUT_FILE diff --git a/script/licenses/willow_license.txt b/script/licenses/willow_license.txt new file mode 100644 index 0000000000..56bbd45a45 --- /dev/null +++ b/script/licenses/willow_license.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 Chad Donohue + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. From 8c855680e7813d10b31f2e8ed92d64cbdfea4b4f Mon Sep 17 00:00:00 2001 From: Mikayla Maki Date: Mon, 17 Jul 2023 13:09:47 -0700 Subject: [PATCH 06/11] Make file types live reload --- assets/icons/file_icons/file_types.json | 3 + crates/project_panel/src/file_associations.rs | 58 ++++++++++--------- crates/project_panel/src/project_panel.rs | 15 +++-- crates/zed/src/main.rs | 25 ++++++++ 4 files changed, 68 insertions(+), 33 deletions(-) diff --git a/assets/icons/file_icons/file_types.json b/assets/icons/file_icons/file_types.json index 8803647857..401e6d1686 100644 --- a/assets/icons/file_icons/file_types.json +++ b/assets/icons/file_icons/file_types.json @@ -67,6 +67,9 @@ "log": "log" }, "types": { + "default": { + "icon": "icons/file_icons/quill/file.svg" + }, "directory": { "icon": "icons/file_icons/quill/folder.svg" }, diff --git a/crates/project_panel/src/file_associations.rs b/crates/project_panel/src/file_associations.rs index e1fb9b3c64..2d3413ef34 100644 --- a/crates/project_panel/src/file_associations.rs +++ b/crates/project_panel/src/file_associations.rs @@ -4,6 +4,7 @@ use collections::HashMap; use gpui::{AppContext, AssetSource}; use serde_derive::Deserialize; +use util::iife; #[derive(Deserialize, Debug)] struct TypeConfig { @@ -16,9 +17,9 @@ pub struct FileAssociations { types: HashMap, } -pub const TEXT_FILE_ASSET: &'static str = "icons/file_icons/quill/file.svg"; const DIRECTORY_TYPE: &'static str = "directory"; const EXPANDED_DIRECTORY_TYPE: &'static str = "expanded_directory"; +pub const FILE_TYPES_ASSET: &'static str = "icons/file_icons/file_types.json"; pub fn init(assets: impl AssetSource, cx: &mut AppContext) { cx.set_global(FileAssociations::new(assets)) @@ -28,8 +29,9 @@ impl FileAssociations { pub fn new(assets: impl AssetSource) -> Self { assets .load("icons/file_icons/file_types.json") - .map(|file| { - serde_json::from_str::(str::from_utf8(&file).unwrap()).unwrap() + .and_then(|file| { + serde_json::from_str::(str::from_utf8(&file).unwrap()) + .map_err(Into::into) }) .unwrap_or_else(|_| FileAssociations { suffixes: HashMap::default(), @@ -37,35 +39,37 @@ impl FileAssociations { }) } - pub fn get_icon(path: &Path, cx: &AppContext) -> Option> { - if !cx.has_global::() { - return None; - } + pub fn get_icon(path: &Path, cx: &AppContext) -> Arc { + iife!({ + let this = cx.has_global::().then(|| cx.global::())?; - let this = cx.global::(); - let suffix = path.extension()?.to_str()?; + iife!({ + let suffix = path.extension()?.to_str()?; - this.suffixes - .get(suffix) - .and_then(|type_str| this.types.get(type_str)) - .map(|type_config| type_config.icon.clone()) + this.suffixes + .get(suffix) + .and_then(|type_str| this.types.get(type_str)) + .map(|type_config| type_config.icon.clone()) + }) + .or_else(|| this.types.get("default").map(|config| config.icon.clone())) + }) + .unwrap_or_else(|| Arc::from("".to_string())) } - pub fn get_folder_icon(expanded: bool, cx: &AppContext) -> Option> { - if !cx.has_global::() { - return None; - } + pub fn get_folder_icon(expanded: bool, cx: &AppContext) -> Arc { + iife!({ + let this = cx.has_global::().then(|| cx.global::())?; - let this = cx.global::(); + let key = if expanded { + EXPANDED_DIRECTORY_TYPE + } else { + DIRECTORY_TYPE + }; - let key = if expanded { - EXPANDED_DIRECTORY_TYPE - } else { - DIRECTORY_TYPE - }; - - this.types - .get(key) - .map(|type_config| type_config.icon.clone()) + this.types + .get(key) + .map(|type_config| type_config.icon.clone()) + }) + .unwrap_or_else(|| Arc::from("".to_string())) } } diff --git a/crates/project_panel/src/project_panel.rs b/crates/project_panel/src/project_panel.rs index dd40fdd561..f8e1b223d3 100644 --- a/crates/project_panel/src/project_panel.rs +++ b/crates/project_panel/src/project_panel.rs @@ -1,11 +1,12 @@ -mod file_associations; +pub mod file_associations; mod project_panel_settings; use context_menu::{ContextMenu, ContextMenuItem}; use db::kvp::KEY_VALUE_STORE; use drag_and_drop::{DragAndDrop, Draggable}; use editor::{Cancel, Editor}; -use file_associations::{FileAssociations, TEXT_FILE_ASSET}; +use file_associations::FileAssociations; + use futures::stream::StreamExt; use gpui::{ actions, @@ -234,6 +235,10 @@ impl ProjectPanel { }) .detach(); + cx.observe_global::(|_, cx| { + cx.notify(); + }).detach(); + let view_id = cx.view_id(); let mut this = Self { project: project.clone(), @@ -1189,11 +1194,9 @@ impl ProjectPanel { let is_expanded = expanded_entry_ids.binary_search(&entry.id).is_ok(); let icon = show_file_icons .then(|| match entry.kind { - EntryKind::File(_) => FileAssociations::get_icon(&entry.path, cx) - .or_else(|| Some(TEXT_FILE_ASSET.into())), + EntryKind::File(_) => FileAssociations::get_icon(&entry.path, cx), _ => FileAssociations::get_folder_icon(is_expanded, cx), - }) - .flatten(); + }); let mut details = EntryDetails { filename: entry diff --git a/crates/zed/src/main.rs b/crates/zed/src/main.rs index e85113d57d..87e00a70c2 100644 --- a/crates/zed/src/main.rs +++ b/crates/zed/src/main.rs @@ -166,6 +166,7 @@ fn main() { cx.spawn(|cx| watch_themes(fs.clone(), cx)).detach(); cx.spawn(|_| watch_languages(fs.clone(), languages.clone())) .detach(); + watch_file_types(fs.clone(), cx); languages.set_theme(theme::current(cx).clone()); cx.observe_global::({ @@ -685,6 +686,25 @@ async fn watch_languages(fs: Arc, languages: Arc) -> O Some(()) } +#[cfg(debug_assertions)] +fn watch_file_types(fs: Arc, cx: &mut AppContext) { + cx.spawn(|mut cx| async move { + let mut events = fs + .watch( + "assets/icons/file_icons/file_types.json".as_ref(), + Duration::from_millis(100), + ) + .await; + while (events.next().await).is_some() { + cx.update(|cx| { + cx.update_global(|file_types, _| { + *file_types = project_panel::file_associations::FileAssociations::new(Assets); + }); + }) + } + }).detach() +} + #[cfg(not(debug_assertions))] async fn watch_themes(_fs: Arc, _cx: AsyncAppContext) -> Option<()> { None @@ -695,6 +715,11 @@ async fn watch_languages(_: Arc, _: Arc) -> Option<()> None } +#[cfg(not(debug_assertions))] +fn watch_file_types(fs: Arc, cx: &mut AppContext) { + None +} + fn connect_to_cli( server_name: &str, ) -> Result<(mpsc::Receiver, IpcSender)> { From aacc4bb8b00f3c17975d51ed024841e8bc48db83 Mon Sep 17 00:00:00 2001 From: Mikayla Maki Date: Mon, 17 Jul 2023 13:12:14 -0700 Subject: [PATCH 07/11] fmt --- crates/project_panel/src/project_panel.rs | 12 ++++++------ crates/zed/src/main.rs | 3 ++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/crates/project_panel/src/project_panel.rs b/crates/project_panel/src/project_panel.rs index f8e1b223d3..d97c47a339 100644 --- a/crates/project_panel/src/project_panel.rs +++ b/crates/project_panel/src/project_panel.rs @@ -237,7 +237,8 @@ impl ProjectPanel { cx.observe_global::(|_, cx| { cx.notify(); - }).detach(); + }) + .detach(); let view_id = cx.view_id(); let mut this = Self { @@ -1192,11 +1193,10 @@ impl ProjectPanel { for entry in visible_worktree_entries[entry_range].iter() { let status = git_status_setting.then(|| entry.git_status).flatten(); let is_expanded = expanded_entry_ids.binary_search(&entry.id).is_ok(); - let icon = show_file_icons - .then(|| match entry.kind { - EntryKind::File(_) => FileAssociations::get_icon(&entry.path, cx), - _ => FileAssociations::get_folder_icon(is_expanded, cx), - }); + let icon = show_file_icons.then(|| match entry.kind { + EntryKind::File(_) => FileAssociations::get_icon(&entry.path, cx), + _ => FileAssociations::get_folder_icon(is_expanded, cx), + }); let mut details = EntryDetails { filename: entry diff --git a/crates/zed/src/main.rs b/crates/zed/src/main.rs index 87e00a70c2..901724ae89 100644 --- a/crates/zed/src/main.rs +++ b/crates/zed/src/main.rs @@ -702,7 +702,8 @@ fn watch_file_types(fs: Arc, cx: &mut AppContext) { }); }) } - }).detach() + }) + .detach() } #[cfg(not(debug_assertions))] From c754c1e9e24a8c8a7b0b0897d68eb8be367e1e2e Mon Sep 17 00:00:00 2001 From: Derek Briggs Date: Wed, 19 Jul 2023 11:28:33 -0600 Subject: [PATCH 08/11] Update icons to new zed file icon set --- assets/icons/file_icons/archive.svg | 5 + assets/icons/file_icons/book.svg | 4 + assets/icons/file_icons/camera.svg | 4 + assets/icons/file_icons/code.svg | 4 + assets/icons/file_icons/database.svg | 5 + assets/icons/file_icons/eslint.svg | 4 + assets/icons/file_icons/file.svg | 5 + assets/icons/file_icons/file_types.json | 188 ++++++++++-------- assets/icons/file_icons/folder-open.svg | 4 + assets/icons/file_icons/folder.svg | 4 + assets/icons/file_icons/git.svg | 6 + assets/icons/file_icons/hash.svg | 6 + assets/icons/file_icons/html.svg | 5 + assets/icons/file_icons/image.svg | 6 + assets/icons/file_icons/info.svg | 5 + assets/icons/file_icons/lock.svg | 6 + assets/icons/file_icons/notebook.svg | 6 + assets/icons/file_icons/package.svg | 3 + assets/icons/file_icons/prettier.svg | 12 ++ assets/icons/file_icons/quill/anchor.svg | 11 - assets/icons/file_icons/quill/archive.svg | 12 -- assets/icons/file_icons/quill/book.svg | 11 - assets/icons/file_icons/quill/camera.svg | 12 -- assets/icons/file_icons/quill/code.svg | 12 -- assets/icons/file_icons/quill/database.svg | 11 - assets/icons/file_icons/quill/eslint.svg | 10 - assets/icons/file_icons/quill/file.svg | 11 - assets/icons/file_icons/quill/folder-open.svg | 12 -- assets/icons/file_icons/quill/folder.svg | 11 - assets/icons/file_icons/quill/git.svg | 11 - assets/icons/file_icons/quill/hash.svg | 11 - assets/icons/file_icons/quill/html.svg | 12 -- assets/icons/file_icons/quill/image.svg | 12 -- assets/icons/file_icons/quill/info.svg | 12 -- assets/icons/file_icons/quill/lock.svg | 11 - assets/icons/file_icons/quill/package.svg | 11 - assets/icons/file_icons/quill/prettier.svg | 22 -- assets/icons/file_icons/quill/settings.svg | 11 - assets/icons/file_icons/quill/terminal.svg | 9 - assets/icons/file_icons/rust.svg | 4 + assets/icons/file_icons/settings.svg | 4 + assets/icons/file_icons/terminal.svg | 5 + assets/icons/file_icons/typescript.svg | 5 + script/generate-licenses | 7 - script/licenses/willow_license.txt | 21 -- styles/src/style_tree/project_panel.ts | 20 +- 46 files changed, 228 insertions(+), 355 deletions(-) create mode 100644 assets/icons/file_icons/archive.svg create mode 100644 assets/icons/file_icons/book.svg create mode 100644 assets/icons/file_icons/camera.svg create mode 100644 assets/icons/file_icons/code.svg create mode 100644 assets/icons/file_icons/database.svg create mode 100644 assets/icons/file_icons/eslint.svg create mode 100644 assets/icons/file_icons/file.svg create mode 100644 assets/icons/file_icons/folder-open.svg create mode 100644 assets/icons/file_icons/folder.svg create mode 100644 assets/icons/file_icons/git.svg create mode 100644 assets/icons/file_icons/hash.svg create mode 100644 assets/icons/file_icons/html.svg create mode 100644 assets/icons/file_icons/image.svg create mode 100644 assets/icons/file_icons/info.svg create mode 100644 assets/icons/file_icons/lock.svg create mode 100644 assets/icons/file_icons/notebook.svg create mode 100644 assets/icons/file_icons/package.svg create mode 100644 assets/icons/file_icons/prettier.svg delete mode 100644 assets/icons/file_icons/quill/anchor.svg delete mode 100644 assets/icons/file_icons/quill/archive.svg delete mode 100644 assets/icons/file_icons/quill/book.svg delete mode 100644 assets/icons/file_icons/quill/camera.svg delete mode 100644 assets/icons/file_icons/quill/code.svg delete mode 100644 assets/icons/file_icons/quill/database.svg delete mode 100644 assets/icons/file_icons/quill/eslint.svg delete mode 100644 assets/icons/file_icons/quill/file.svg delete mode 100644 assets/icons/file_icons/quill/folder-open.svg delete mode 100644 assets/icons/file_icons/quill/folder.svg delete mode 100644 assets/icons/file_icons/quill/git.svg delete mode 100644 assets/icons/file_icons/quill/hash.svg delete mode 100644 assets/icons/file_icons/quill/html.svg delete mode 100644 assets/icons/file_icons/quill/image.svg delete mode 100644 assets/icons/file_icons/quill/info.svg delete mode 100644 assets/icons/file_icons/quill/lock.svg delete mode 100644 assets/icons/file_icons/quill/package.svg delete mode 100644 assets/icons/file_icons/quill/prettier.svg delete mode 100644 assets/icons/file_icons/quill/settings.svg delete mode 100644 assets/icons/file_icons/quill/terminal.svg create mode 100644 assets/icons/file_icons/rust.svg create mode 100644 assets/icons/file_icons/settings.svg create mode 100644 assets/icons/file_icons/terminal.svg create mode 100644 assets/icons/file_icons/typescript.svg delete mode 100644 script/licenses/willow_license.txt diff --git a/assets/icons/file_icons/archive.svg b/assets/icons/file_icons/archive.svg new file mode 100644 index 0000000000..f11115cdce --- /dev/null +++ b/assets/icons/file_icons/archive.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/assets/icons/file_icons/book.svg b/assets/icons/file_icons/book.svg new file mode 100644 index 0000000000..890b8988a3 --- /dev/null +++ b/assets/icons/file_icons/book.svg @@ -0,0 +1,4 @@ + + + + diff --git a/assets/icons/file_icons/camera.svg b/assets/icons/file_icons/camera.svg new file mode 100644 index 0000000000..d8b9cf459c --- /dev/null +++ b/assets/icons/file_icons/camera.svg @@ -0,0 +1,4 @@ + + + + diff --git a/assets/icons/file_icons/code.svg b/assets/icons/file_icons/code.svg new file mode 100644 index 0000000000..2733e4b535 --- /dev/null +++ b/assets/icons/file_icons/code.svg @@ -0,0 +1,4 @@ + + + + diff --git a/assets/icons/file_icons/database.svg b/assets/icons/file_icons/database.svg new file mode 100644 index 0000000000..9072e091b5 --- /dev/null +++ b/assets/icons/file_icons/database.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/assets/icons/file_icons/eslint.svg b/assets/icons/file_icons/eslint.svg new file mode 100644 index 0000000000..ec5051d447 --- /dev/null +++ b/assets/icons/file_icons/eslint.svg @@ -0,0 +1,4 @@ + + + + diff --git a/assets/icons/file_icons/file.svg b/assets/icons/file_icons/file.svg new file mode 100644 index 0000000000..cc422734e7 --- /dev/null +++ b/assets/icons/file_icons/file.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/assets/icons/file_icons/file_types.json b/assets/icons/file_icons/file_types.json index 401e6d1686..d1b604f05e 100644 --- a/assets/icons/file_icons/file_types.json +++ b/assets/icons/file_icons/file_types.json @@ -1,110 +1,134 @@ { "suffixes": { - "jpg": "image", - "jpeg": "image", - "tiff": "image", - "svg": "image", - "psd": "image", - "png": "image", - "gif": "image", - "bmp": "image", - "ico": "image", - "mp4": "video", - "webm": "video", - "ogg": "video", - "mp3": "audio", - "wav": "audio", - "flac": "audio", "aac": "audio", - "pdf": "document", + "bash": "terminal", + "bmp": "image", + "c": "code", + "conf": "settings", + "cpp": "code", + "css": "code", "doc": "document", "docx": "document", - "xls": "document", - "xlsx": "document", - "ppt": "document", - "pptx": "document", - "odt": "document", + "eslintrc": "eslint", + "eslintrc.js": "eslint", + "eslintrc.json": "eslint", + "flac": "audio", + "fish": "terminal", + "gitattributes": "vcs", + "gitignore": "vcs", + "gif": "image", + "go": "code", + "h": "code", + "handlebars": "code", + "hbs": "template", + "htm": "template", + "html": "template", + "hpp": "code", + "ico": "image", + "ini": "settings", + "java": "code", + "jpeg": "image", + "jpg": "image", + "js": "code", + "json": "storage", + "lock": "lock", + "log": "log", + "md": "document", + "mp3": "audio", + "mp4": "video", "ods": "document", "odp": "document", - "txt": "document", - "rtf": "document", - "md": "document", - "html": "template", - "htm": "template", - "xml": "template", - "hbs": "template", - "handlebars": "template", - "js": "code", - "css": "code", + "odt": "document", + "ogg": "video", + "pdf": "document", "php": "code", - "c": "code", - "cpp": "code", - "h": "code", - "hpp": "code", - "java": "code", + "png": "image", + "ppt": "document", + "pptx": "document", + "prettierrc": "prettier", + "ps1": "terminal", + "psd": "image", "py": "code", - "swift": "code", - "go": "code", "rb": "code", - "rs": "code", "rkt": "code", + "rs": "rust", + "rtf": "document", "scm": "code", + "sh": "terminal", "sql": "code", - "json": "settings", - "ini": "settings", + "svg": "image", + "swift": "code", + "tiff": "image", + "toml": "settings", + "ts": "typescript", + "tsx": "code", + "txt": "document", + "wav": "audio", + "webm": "video", + "xls": "document", + "xlsx": "document", + "xml": "template", "yaml": "settings", "yml": "settings", - "toml": "settings", - "conf": "settings", - "lock": "settings", - "gitignore": "vcs", - "gitattributes": "vcs", - "ps1": "terminal", - "sh": "terminal", - "bash": "terminal", - "zsh": "terminal", - "fish": "terminal", - "log": "log" + "zsh": "terminal" }, "types": { - "default": { - "icon": "icons/file_icons/quill/file.svg" - }, - "directory": { - "icon": "icons/file_icons/quill/folder.svg" - }, - "expanded_directory": { - "icon": "icons/file_icons/quill/folder-open.svg" - }, - "image": { - "icon": "icons/file_icons/quill/image.svg" - }, - "video": { - "icon": "icons/file_icons/quill/file.svg" - }, "audio": { - "icon": "icons/file_icons/quill/file.svg" - }, - "document": { - "icon": "icons/file_icons/quill/book.svg" - }, - "template": { - "icon": "icons/file_icons/quill/html.svg" + "icon": "icons/file_icons/file.svg" }, "code": { - "icon": "icons/file_icons/quill/code.svg" + "icon": "icons/file_icons/code.svg" }, - "settings": { - "icon": "icons/file_icons/quill/settings.svg" + "default": { + "icon": "icons/file_icons/file.svg" }, - "vcs": { - "icon": "icons/file_icons/quill/git.svg" + "directory": { + "icon": "icons/file_icons/folder.svg" }, - "terminal": { - "icon": "icons/file_icons/quill/terminal.svg" + "document": { + "icon": "icons/file_icons/book.svg" + }, + "eslint": { + "icon": "icons/file_icons/eslint.svg" + }, + "expanded_directory": { + "icon": "icons/file_icons/folder-open.svg" + }, + "image": { + "icon": "icons/file_icons/image.svg" + }, + "lock": { + "icon": "icons/file_icons/lock.svg" }, "log": { - "icon": "icons/file_icons/quill/info.svg" + "icon": "icons/file_icons/info.svg" + }, + "prettier": { + "icon": "icons/file_icons/prettier.svg" + }, + "rust": { + "icon": "icons/file_icons/rust.svg" + }, + "settings": { + "icon": "icons/file_icons/settings.svg" + }, + "storage": { + "icon": "icons/file_icons/database.svg" + }, + "template": { + "icon": "icons/file_icons/html.svg" + }, + "terminal": { + "icon": "icons/file_icons/terminal.svg" + }, + "typescript": { + "icon": "icons/file_icons/typescript.svg" + }, + "vcs": { + "icon": "icons/file_icons/git.svg" + }, + "video": { + "icon": "icons/file_icons/file.svg" } } } diff --git a/assets/icons/file_icons/folder-open.svg b/assets/icons/file_icons/folder-open.svg new file mode 100644 index 0000000000..65c5744049 --- /dev/null +++ b/assets/icons/file_icons/folder-open.svg @@ -0,0 +1,4 @@ + + + + diff --git a/assets/icons/file_icons/folder.svg b/assets/icons/file_icons/folder.svg new file mode 100644 index 0000000000..5157bae839 --- /dev/null +++ b/assets/icons/file_icons/folder.svg @@ -0,0 +1,4 @@ + + + + diff --git a/assets/icons/file_icons/git.svg b/assets/icons/file_icons/git.svg new file mode 100644 index 0000000000..82d8c8f57c --- /dev/null +++ b/assets/icons/file_icons/git.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/icons/file_icons/hash.svg b/assets/icons/file_icons/hash.svg new file mode 100644 index 0000000000..edd0462678 --- /dev/null +++ b/assets/icons/file_icons/hash.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/icons/file_icons/html.svg b/assets/icons/file_icons/html.svg new file mode 100644 index 0000000000..ba9ec14299 --- /dev/null +++ b/assets/icons/file_icons/html.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/assets/icons/file_icons/image.svg b/assets/icons/file_icons/image.svg new file mode 100644 index 0000000000..ee5e49f2d4 --- /dev/null +++ b/assets/icons/file_icons/image.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/icons/file_icons/info.svg b/assets/icons/file_icons/info.svg new file mode 100644 index 0000000000..e84ae7c628 --- /dev/null +++ b/assets/icons/file_icons/info.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/assets/icons/file_icons/lock.svg b/assets/icons/file_icons/lock.svg new file mode 100644 index 0000000000..3051bbf801 --- /dev/null +++ b/assets/icons/file_icons/lock.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/icons/file_icons/notebook.svg b/assets/icons/file_icons/notebook.svg new file mode 100644 index 0000000000..6eaec16d0a --- /dev/null +++ b/assets/icons/file_icons/notebook.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/icons/file_icons/package.svg b/assets/icons/file_icons/package.svg new file mode 100644 index 0000000000..2a692ba4b4 --- /dev/null +++ b/assets/icons/file_icons/package.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/icons/file_icons/prettier.svg b/assets/icons/file_icons/prettier.svg new file mode 100644 index 0000000000..2d2c6ee719 --- /dev/null +++ b/assets/icons/file_icons/prettier.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/assets/icons/file_icons/quill/anchor.svg b/assets/icons/file_icons/quill/anchor.svg deleted file mode 100644 index 4828578ee0..0000000000 --- a/assets/icons/file_icons/quill/anchor.svg +++ /dev/null @@ -1,11 +0,0 @@ - - - - anchor_dark - Created with Sketch. - - - - - - \ No newline at end of file diff --git a/assets/icons/file_icons/quill/archive.svg b/assets/icons/file_icons/quill/archive.svg deleted file mode 100644 index c78ca0cff6..0000000000 --- a/assets/icons/file_icons/quill/archive.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - archive_dark - Created with Sketch. - - - - - - - \ No newline at end of file diff --git a/assets/icons/file_icons/quill/book.svg b/assets/icons/file_icons/quill/book.svg deleted file mode 100644 index af918b5c61..0000000000 --- a/assets/icons/file_icons/quill/book.svg +++ /dev/null @@ -1,11 +0,0 @@ - - - - book_dark - Created with Sketch. - - - - - - \ No newline at end of file diff --git a/assets/icons/file_icons/quill/camera.svg b/assets/icons/file_icons/quill/camera.svg deleted file mode 100644 index f861af607c..0000000000 --- a/assets/icons/file_icons/quill/camera.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - camera_dark - Created with Sketch. - - - - - - - \ No newline at end of file diff --git a/assets/icons/file_icons/quill/code.svg b/assets/icons/file_icons/quill/code.svg deleted file mode 100644 index a844740f1a..0000000000 --- a/assets/icons/file_icons/quill/code.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - code_dark - Created with Sketch. - - - - - - - \ No newline at end of file diff --git a/assets/icons/file_icons/quill/database.svg b/assets/icons/file_icons/quill/database.svg deleted file mode 100644 index 8c98d5ac16..0000000000 --- a/assets/icons/file_icons/quill/database.svg +++ /dev/null @@ -1,11 +0,0 @@ - - - - database_dark - Created with Sketch. - - - - - - \ No newline at end of file diff --git a/assets/icons/file_icons/quill/eslint.svg b/assets/icons/file_icons/quill/eslint.svg deleted file mode 100644 index 880689293a..0000000000 --- a/assets/icons/file_icons/quill/eslint.svg +++ /dev/null @@ -1,10 +0,0 @@ - - - - eslint_dark - Created with Sketch. - - - - - \ No newline at end of file diff --git a/assets/icons/file_icons/quill/file.svg b/assets/icons/file_icons/quill/file.svg deleted file mode 100644 index 492c383ab6..0000000000 --- a/assets/icons/file_icons/quill/file.svg +++ /dev/null @@ -1,11 +0,0 @@ - - - - file_dark - Created with Sketch. - - - - - - \ No newline at end of file diff --git a/assets/icons/file_icons/quill/folder-open.svg b/assets/icons/file_icons/quill/folder-open.svg deleted file mode 100644 index 00a94c199f..0000000000 --- a/assets/icons/file_icons/quill/folder-open.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - folder-open_dark - Created with Sketch. - - - - - - - \ No newline at end of file diff --git a/assets/icons/file_icons/quill/folder.svg b/assets/icons/file_icons/quill/folder.svg deleted file mode 100644 index 9cc5b4a8c9..0000000000 --- a/assets/icons/file_icons/quill/folder.svg +++ /dev/null @@ -1,11 +0,0 @@ - - - - folder_dark - Created with Sketch. - - - - - - \ No newline at end of file diff --git a/assets/icons/file_icons/quill/git.svg b/assets/icons/file_icons/quill/git.svg deleted file mode 100644 index 830a7f9565..0000000000 --- a/assets/icons/file_icons/quill/git.svg +++ /dev/null @@ -1,11 +0,0 @@ - - - - git_dark - Created with Sketch. - - - - - - \ No newline at end of file diff --git a/assets/icons/file_icons/quill/hash.svg b/assets/icons/file_icons/quill/hash.svg deleted file mode 100644 index 36366625fe..0000000000 --- a/assets/icons/file_icons/quill/hash.svg +++ /dev/null @@ -1,11 +0,0 @@ - - - - hash_dark - Created with Sketch. - - - - - - \ No newline at end of file diff --git a/assets/icons/file_icons/quill/html.svg b/assets/icons/file_icons/quill/html.svg deleted file mode 100644 index 7704575f24..0000000000 --- a/assets/icons/file_icons/quill/html.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - html_dark - Created with Sketch. - - - - - - - \ No newline at end of file diff --git a/assets/icons/file_icons/quill/image.svg b/assets/icons/file_icons/quill/image.svg deleted file mode 100644 index 0ec9583edd..0000000000 --- a/assets/icons/file_icons/quill/image.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - image_dark - Created with Sketch. - - - - - - - \ No newline at end of file diff --git a/assets/icons/file_icons/quill/info.svg b/assets/icons/file_icons/quill/info.svg deleted file mode 100644 index af3fa9d39d..0000000000 --- a/assets/icons/file_icons/quill/info.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - info_dark - Created with Sketch. - - - - - - - \ No newline at end of file diff --git a/assets/icons/file_icons/quill/lock.svg b/assets/icons/file_icons/quill/lock.svg deleted file mode 100644 index a1e36e6c12..0000000000 --- a/assets/icons/file_icons/quill/lock.svg +++ /dev/null @@ -1,11 +0,0 @@ - - - - lock_dark - Created with Sketch. - - - - - - \ No newline at end of file diff --git a/assets/icons/file_icons/quill/package.svg b/assets/icons/file_icons/quill/package.svg deleted file mode 100644 index 9bda169cf5..0000000000 --- a/assets/icons/file_icons/quill/package.svg +++ /dev/null @@ -1,11 +0,0 @@ - - - - package_dark - Created with Sketch. - - - - - - \ No newline at end of file diff --git a/assets/icons/file_icons/quill/prettier.svg b/assets/icons/file_icons/quill/prettier.svg deleted file mode 100644 index ba7b340654..0000000000 --- a/assets/icons/file_icons/quill/prettier.svg +++ /dev/null @@ -1,22 +0,0 @@ - - - - prettier_dark - Created with Sketch. - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/assets/icons/file_icons/quill/settings.svg b/assets/icons/file_icons/quill/settings.svg deleted file mode 100644 index f0209bf3c2..0000000000 --- a/assets/icons/file_icons/quill/settings.svg +++ /dev/null @@ -1,11 +0,0 @@ - - - - settings_dark - Created with Sketch. - - - - - - \ No newline at end of file diff --git a/assets/icons/file_icons/quill/terminal.svg b/assets/icons/file_icons/quill/terminal.svg deleted file mode 100644 index 964f44251f..0000000000 --- a/assets/icons/file_icons/quill/terminal.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - - terminal_dark - Created with Sketch. - - - - \ No newline at end of file diff --git a/assets/icons/file_icons/rust.svg b/assets/icons/file_icons/rust.svg new file mode 100644 index 0000000000..1802f0e190 --- /dev/null +++ b/assets/icons/file_icons/rust.svg @@ -0,0 +1,4 @@ + + + + diff --git a/assets/icons/file_icons/settings.svg b/assets/icons/file_icons/settings.svg new file mode 100644 index 0000000000..e827055d19 --- /dev/null +++ b/assets/icons/file_icons/settings.svg @@ -0,0 +1,4 @@ + + + + diff --git a/assets/icons/file_icons/terminal.svg b/assets/icons/file_icons/terminal.svg new file mode 100644 index 0000000000..939587c53e --- /dev/null +++ b/assets/icons/file_icons/terminal.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/assets/icons/file_icons/typescript.svg b/assets/icons/file_icons/typescript.svg new file mode 100644 index 0000000000..179b3d8572 --- /dev/null +++ b/assets/icons/file_icons/typescript.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/script/generate-licenses b/script/generate-licenses index b08aa0b024..9a2fe8921a 100755 --- a/script/generate-licenses +++ b/script/generate-licenses @@ -6,13 +6,6 @@ OUTPUT_FILE=$(pwd)/assets/licenses.md > $OUTPUT_FILE -echo -e "# ###### ICON LICENSES ######\n" >> $OUTPUT_FILE - -echo "Generating icon licenses" - -cat script/licenses/willow_license.txt >> $OUTPUT_FILE -echo -e "" >> $OUTPUT_FILE - echo -e "# ###### THEME LICENSES ######\n" >> $OUTPUT_FILE echo "Generating theme licenses" diff --git a/script/licenses/willow_license.txt b/script/licenses/willow_license.txt deleted file mode 100644 index 56bbd45a45..0000000000 --- a/script/licenses/willow_license.txt +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2019 Chad Donohue - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/styles/src/style_tree/project_panel.ts b/styles/src/style_tree/project_panel.ts index c3e82de8b0..4a252572d5 100644 --- a/styles/src/style_tree/project_panel.ts +++ b/styles/src/style_tree/project_panel.ts @@ -50,7 +50,7 @@ export default function project_panel(): any { icon_color: foreground(theme.middle, "active"), chevron_size: 7, icon_size: 14, - icon_spacing: 5, + icon_spacing: 6, text: text(theme.middle, "sans", "variant", { size: "sm" }), status: { ...git_status, @@ -64,17 +64,17 @@ export default function project_panel(): any { const unselected_default_style = merge( base_properties, unselected?.default ?? {}, - {} + {}, ) const unselected_hovered_style = merge( base_properties, { background: background(theme.middle, "hovered") }, - unselected?.hovered ?? {} + unselected?.hovered ?? {}, ) const unselected_clicked_style = merge( base_properties, { background: background(theme.middle, "pressed") }, - unselected?.clicked ?? {} + unselected?.clicked ?? {}, ) const selected_default_style = merge( base_properties, @@ -82,7 +82,7 @@ export default function project_panel(): any { background: background(theme.lowest), text: text(theme.lowest, "sans", { size: "sm" }), }, - selected_style?.default ?? {} + selected_style?.default ?? {}, ) const selected_hovered_style = merge( base_properties, @@ -90,7 +90,7 @@ export default function project_panel(): any { background: background(theme.lowest, "hovered"), text: text(theme.lowest, "sans", { size: "sm" }), }, - selected_style?.hovered ?? {} + selected_style?.hovered ?? {}, ) const selected_clicked_style = merge( base_properties, @@ -98,7 +98,7 @@ export default function project_panel(): any { background: background(theme.lowest, "pressed"), text: text(theme.lowest, "sans", { size: "sm" }), }, - selected_style?.clicked ?? {} + selected_style?.clicked ?? {}, ) return toggleable({ @@ -157,7 +157,7 @@ export default function project_panel(): any { }), background: background(theme.middle), padding: { left: 6, right: 6, top: 0, bottom: 6 }, - indent_width: 12, + indent_width: 20, entry: default_entry, dragged_entry: { ...default_entry.inactive.default, @@ -175,7 +175,7 @@ export default function project_panel(): any { default: { icon_color: foreground(theme.middle, "variant"), }, - } + }, ), cut_entry: entry( { @@ -190,7 +190,7 @@ export default function project_panel(): any { size: "sm", }), }, - } + }, ), filename_editor: { background: background(theme.middle, "on"), From f4413b0969b26361a822754f8e00aea9f3fd1229 Mon Sep 17 00:00:00 2001 From: Derek Briggs Date: Wed, 19 Jul 2023 12:07:00 -0600 Subject: [PATCH 09/11] =?UTF-8?q?Fix=20files=20that=20don=E2=80=99t=20have?= =?UTF-8?q?=20a=20prefix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/icons/file_icons/file_types.json | 1 + crates/project_panel/src/file_associations.rs | 9 ++++++++- styles/src/style_tree/project_panel.ts | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/assets/icons/file_icons/file_types.json b/assets/icons/file_icons/file_types.json index d1b604f05e..b1da28d2d6 100644 --- a/assets/icons/file_icons/file_types.json +++ b/assets/icons/file_icons/file_types.json @@ -46,6 +46,7 @@ "ppt": "document", "pptx": "document", "prettierrc": "prettier", + "prettierignore": "prettier", "ps1": "terminal", "psd": "image", "py": "code", diff --git a/crates/project_panel/src/file_associations.rs b/crates/project_panel/src/file_associations.rs index 2d3413ef34..e692031704 100644 --- a/crates/project_panel/src/file_associations.rs +++ b/crates/project_panel/src/file_associations.rs @@ -44,7 +44,14 @@ impl FileAssociations { let this = cx.has_global::().then(|| cx.global::())?; iife!({ - let suffix = path.extension()?.to_str()?; + let suffix = + path.file_name() + .and_then(|os_str| os_str.to_str()) + .and_then(|file_name| { + file_name + .find('.') + .and_then(|dot_index| file_name.get(dot_index + 1..)) + } )?; this.suffixes .get(suffix) diff --git a/styles/src/style_tree/project_panel.ts b/styles/src/style_tree/project_panel.ts index 4a252572d5..e239f9a840 100644 --- a/styles/src/style_tree/project_panel.ts +++ b/styles/src/style_tree/project_panel.ts @@ -47,7 +47,7 @@ export default function project_panel(): any { height: 22, background: background(theme.middle), chevron_color: foreground(theme.middle, "variant"), - icon_color: foreground(theme.middle, "active"), + icon_color: with_opacity(foreground(theme.middle, "active"), 0.3), chevron_size: 7, icon_size: 14, icon_spacing: 6, From e3f9a01f6b22f82f065b9a583854c58426d60ef5 Mon Sep 17 00:00:00 2001 From: Mikayla Maki Date: Wed, 19 Jul 2023 11:10:01 -0700 Subject: [PATCH 10/11] fmt --- crates/project_panel/src/file_associations.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/crates/project_panel/src/file_associations.rs b/crates/project_panel/src/file_associations.rs index e692031704..3aaa1689e0 100644 --- a/crates/project_panel/src/file_associations.rs +++ b/crates/project_panel/src/file_associations.rs @@ -44,14 +44,14 @@ impl FileAssociations { let this = cx.has_global::().then(|| cx.global::())?; iife!({ - let suffix = - path.file_name() - .and_then(|os_str| os_str.to_str()) - .and_then(|file_name| { - file_name - .find('.') - .and_then(|dot_index| file_name.get(dot_index + 1..)) - } )?; + let suffix = path + .file_name() + .and_then(|os_str| os_str.to_str()) + .and_then(|file_name| { + file_name + .find('.') + .and_then(|dot_index| file_name.get(dot_index + 1..)) + })?; this.suffixes .get(suffix) From 9c9ce15afc80ebb125b5b0ab8b92fe74491c890f Mon Sep 17 00:00:00 2001 From: Mikayla Maki Date: Wed, 19 Jul 2023 11:14:31 -0700 Subject: [PATCH 11/11] Add a few more spare associations --- assets/icons/file_icons/file_types.json | 14 ++++++++++++++ crates/project_panel/src/file_associations.rs | 2 ++ 2 files changed, 16 insertions(+) diff --git a/assets/icons/file_icons/file_types.json b/assets/icons/file_icons/file_types.json index b1da28d2d6..4f3f8160d7 100644 --- a/assets/icons/file_icons/file_types.json +++ b/assets/icons/file_icons/file_types.json @@ -6,6 +6,7 @@ "c": "code", "conf": "settings", "cpp": "code", + "cc": "code", "css": "code", "doc": "document", "docx": "document", @@ -23,6 +24,7 @@ "hbs": "template", "htm": "template", "html": "template", + "svelte": "template", "hpp": "code", "ico": "image", "ini": "settings", @@ -34,6 +36,7 @@ "lock": "lock", "log": "log", "md": "document", + "mdx": "document", "mp3": "audio", "mp4": "video", "ods": "document", @@ -56,6 +59,17 @@ "rtf": "document", "scm": "code", "sh": "terminal", + "bashrc": "terminal", + "bash_profile": "terminal", + "bash_aliases": "terminal", + "bash_logout": "terminal", + "profile": "terminal", + "zshrc": "terminal", + "zshenv": "terminal", + "zsh_profile": "terminal", + "zsh_aliases": "terminal", + "zsh_histfile": "terminal", + "zlogin": "terminal", "sql": "code", "svg": "image", "swift": "code", diff --git a/crates/project_panel/src/file_associations.rs b/crates/project_panel/src/file_associations.rs index 3aaa1689e0..6e2e373d76 100644 --- a/crates/project_panel/src/file_associations.rs +++ b/crates/project_panel/src/file_associations.rs @@ -43,6 +43,8 @@ impl FileAssociations { iife!({ let this = cx.has_global::().then(|| cx.global::())?; + // FIXME: Associate a type with the languages and have the file's langauge + // override these associations iife!({ let suffix = path .file_name()