Cargo.lock 🔗
@@ -5360,6 +5360,7 @@ version = "0.1.0"
dependencies = [
"anyhow",
"client",
+ "collections",
"context_menu",
"db",
"drag_and_drop",
Mikayla Maki created
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 | 7 +
assets/icons/file_icons/quill/database.svg | 7 +
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 | 7 +
assets/icons/file_icons/quill/hash.svg | 7 +
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 | 7 +
assets/icons/file_icons/quill/prettier.svg | 22 ++++
assets/icons/file_icons/quill/settings.svg | 7 +
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, 426 insertions(+), 62 deletions(-)
@@ -5360,6 +5360,7 @@ version = "0.1.0"
dependencies = [
"anyhow",
"client",
+ "collections",
"context_menu",
"db",
"drag_and_drop",
@@ -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"
+ }
+ }
+}
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="32px" height="32px" viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <!-- Generator: Sketch 59.1 (86144) - https://sketch.com -->
+ <title>anchor_dark</title>
+ <desc>Created with Sketch.</desc>
+ <g id="anchor_dark" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" fill-opacity="0.16">
+ <g id="anchor" transform="translate(4.000000, 4.000000)" fill="#F0F4F8" fill-rule="nonzero">
+ <path d="M13.5,20.3680668 C16.9921024,19.7462957 19.7462957,16.9921024 20.3680668,13.5 L19,13.5 C18.1715729,13.5 17.5,12.8284271 17.5,12 C17.5,11.1715729 18.1715729,10.5 19,10.5 L22,10.5 C22.8284271,10.5 23.5,11.1715729 23.5,12 C23.5,18.3512746 18.3512746,23.5 12,23.5 C5.64872538,23.5 0.5,18.3512746 0.5,12 C0.5,11.1715729 1.17157288,10.5 2,10.5 L5,10.5 C5.82842712,10.5 6.5,11.1715729 6.5,12 C6.5,12.8284271 5.82842712,13.5 5,13.5 L3.63193315,13.5 C4.25370429,16.9921024 7.00789762,19.7462957 10.5,20.3680668 L10.5,9.24394144 C8.75221144,8.62618683 7.5,6.95932824 7.5,5 C7.5,2.51471863 9.51471863,0.5 12,0.5 C14.4852814,0.5 16.5,2.51471863 16.5,5 C16.5,6.95932824 15.2477886,8.62618683 13.5,9.24394144 L13.5,20.3680668 Z M12,6.5 C12.8284271,6.5 13.5,5.82842712 13.5,5 C13.5,4.17157288 12.8284271,3.5 12,3.5 C11.1715729,3.5 10.5,4.17157288 10.5,5 C10.5,5.82842712 11.1715729,6.5 12,6.5 Z" id="Shape"></path>
+ </g>
+ </g>
+</svg>
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="32px" height="32px" viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <!-- Generator: Sketch 59.1 (86144) - https://sketch.com -->
+ <title>archive_dark</title>
+ <desc>Created with Sketch.</desc>
+ <g id="archive_dark" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
+ <g id="archive" transform="translate(3.000000, 5.000000)">
+ <path d="M20.5,8.5 L5.5,8.5 L5.5,18.5 L20.5,18.5 L20.5,8.5 Z M23.5,8.5 L23.5,20 C23.5,20.8284271 22.8284271,21.5 22,21.5 L4,21.5 C3.17157288,21.5 2.5,20.8284271 2.5,20 L2.5,8.5 L2,8.5 C1.17157288,8.5 0.5,7.82842712 0.5,7 L0.5,2 C0.5,1.17157288 1.17157288,0.5 2,0.5 L24,0.5 C24.8284271,0.5 25.5,1.17157288 25.5,2 L25.5,7 C25.5,7.82842712 24.8284271,8.5 24,8.5 L23.5,8.5 Z M3.5,3.5 L3.5,5.5 L22.5,5.5 L22.5,3.5 L3.5,3.5 Z" id="Shape" fill-opacity="0.16" fill="#F0F4F8" fill-rule="nonzero"></path>
+ <line x1="11" y1="13" x2="15" y2="13" id="Shape" stroke-opacity="0.16" stroke="#F0F4F8" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"></line>
+ </g>
+ </g>
+</svg>
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="32px" height="32px" viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <!-- Generator: Sketch 59.1 (86144) - https://sketch.com -->
+ <title>book_dark</title>
+ <desc>Created with Sketch.</desc>
+ <g id="book_dark" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" fill-opacity="0.16">
+ <g id="book-open" transform="translate(4.000000, 5.000000)" fill="#F0F4F8" fill-rule="nonzero">
+ <path d="M8,0.5 C9.5760283,0.5 10.9972305,1.16288947 12,2.2250619 C13.0027695,1.16288947 14.4239717,0.5 16,0.5 L22,0.5 C22.8284271,0.5 23.5,1.17157288 23.5,2 L23.5,17 C23.5,17.8284271 22.8284271,18.5 22,18.5 L15,18.5 C14.1715729,18.5 13.5,19.1715729 13.5,20 C13.5,22 10.5,22 10.5,20 C10.5,19.1715729 9.82842712,18.5 9,18.5 L2,18.5 C1.17157288,18.5 0.5,17.8284271 0.5,17 L0.5,2 C0.5,1.17157288 1.17157288,0.5 2,0.5 L8,0.5 Z M7.5,3 L4.5,3 C3.94771525,3 3.5,3.44771525 3.5,4 L3.5,4 L3.5,15 C3.5,15.5522847 3.94771525,16 4.5,16 L4.5,16 L9.5,16 C10.0522847,16 10.5,15.5522847 10.5,15 L10.5,15 L10.5,6 C10.5,4.34314575 9.15685425,3 7.5,3 L7.5,3 Z M19.5,3 L16.5,3 C14.8431458,3 13.5,4.34314575 13.5,6 L13.5,15 C13.5,15.5522847 13.9477153,16 14.5,16 L19.5,16 C20.0522847,16 20.5,15.5522847 20.5,15 L20.5,4 C20.5,3.44771525 20.0522847,3 19.5,3 Z" id="Combined-Shape"></path>
+ </g>
+ </g>
+</svg>
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="32px" height="32px" viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <!-- Generator: Sketch 59.1 (86144) - https://sketch.com -->
+ <title>camera_dark</title>
+ <desc>Created with Sketch.</desc>
+ <g id="camera_dark" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round" stroke-opacity="0.16">
+ <g id="camera-(1)" transform="translate(5.000000, 7.000000)" stroke="#F0F4F8" stroke-width="3">
+ <path d="M22,16 C22,17.1045695 21.1045695,18 20,18 L2,18 C0.8954305,18 0,17.1045695 0,16 L0,5 C0,3.8954305 0.8954305,3 2,3 L6,3 L8,0 L14,0 L16,3 L20,3 C21.1045695,3 22,3.8954305 22,5 L22,16 Z" id="Shape"></path>
+ <circle id="Oval" cx="11" cy="10" r="3"></circle>
+ </g>
+ </g>
+</svg>
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="32px" height="32px" viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <!-- Generator: Sketch 59.1 (86144) - https://sketch.com -->
+ <title>code_dark</title>
+ <desc>Created with Sketch.</desc>
+ <g id="code_dark" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" fill-opacity="0.16">
+ <g id="Group" transform="translate(4.000000, 6.000000)" fill="#F0F4F8">
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="32px" height="32px" viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <!-- Generator: Sketch 59.1 (86144) - https://sketch.com -->
+ <title>database_dark</title>
+ <desc>Created with Sketch.</desc>
+ <g id="database_dark" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" fill-opacity="0.16">
+ <g id="database" transform="translate(7.000000, 6.000000)" fill="#F0F4F8" fill-rule="nonzero">
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="32px" height="32px" viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <!-- Generator: Sketch 59.1 (86144) - https://sketch.com -->
+ <title>eslint_dark</title>
+ <desc>Created with Sketch.</desc>
+ <g id="eslint_dark" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
+ <path d="M16.4592921,5.28867513 L25.4185843,10.4613249 C25.7279854,10.6399577 25.9185843,10.9700847 25.9185843,11.3273503 L25.9185843,21.6726497 C25.9185843,22.0299153 25.7279854,22.3600423 25.4185843,22.5386751 L16.4592921,27.7113249 C16.1498911,27.8899577 15.7686932,27.8899577 15.4592921,27.7113249 L6.5,22.5386751 C6.19059892,22.3600423 6,22.0299153 6,21.6726497 L6,11.3273503 C6,10.9700847 6.19059892,10.6399577 6.5,10.4613249 L15.4592921,5.28867513 C15.7686932,5.11004234 16.1498911,5.11004234 16.4592921,5.28867513 Z" id="Polygon" stroke-opacity="0.16" stroke="#F0F4F8" stroke-width="3" fill-rule="nonzero" transform="translate(15.959292, 16.500000) rotate(-330.000000) translate(-15.959292, -16.500000) "></path>
+ <path d="M16.4472589,11.1185988 L20.3945179,13.3975498 C20.7039189,13.5761826 20.8945179,13.9063096 20.8945179,14.2635752 L20.8945179,18.8214772 C20.8945179,19.1787428 20.7039189,19.5088698 20.3945179,19.6875026 L16.4472589,21.9664536 C16.1378579,22.1450864 15.75666,22.1450864 15.4472589,21.9664536 L11.5,19.6875026 C11.1905989,19.5088698 11,19.1787428 11,18.8214772 L11,14.2635752 C11,13.9063096 11.1905989,13.5761826 11.5,13.3975498 L15.4472589,11.1185988 C15.75666,10.939966 16.1378579,10.939966 16.4472589,11.1185988 Z" id="Polygon-Copy" fill-opacity="0.16" fill="#F0F4F8" fill-rule="nonzero" transform="translate(15.947259, 16.542526) rotate(-360.000000) translate(-15.947259, -16.542526) "></path>
+ </g>
+</svg>
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="32px" height="32px" viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <!-- Generator: Sketch 59.1 (86144) - https://sketch.com -->
+ <title>file_dark</title>
+ <desc>Created with Sketch.</desc>
+ <g id="file_dark" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" fill-opacity="0.16">
+ <rect id="Rectangle" fill="#F0F4F8" fill-rule="nonzero" x="6" y="6" width="16" height="3" rx="1.5"></rect>
+ <rect id="Rectangle-Copy" fill="#F0F4F8" fill-rule="nonzero" x="6" y="14" width="20" height="3" rx="1.5"></rect>
+ <rect id="Rectangle-Copy-2" fill="#F0F4F8" fill-rule="nonzero" x="6" y="22" width="11" height="3" rx="1.5"></rect>
+ </g>
+</svg>
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="32px" height="32px" viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <!-- Generator: Sketch 59.1 (86144) - https://sketch.com -->
+ <title>folder-open_dark</title>
+ <desc>Created with Sketch.</desc>
+ <g id="folder-open_dark" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
+ <g id="folder-plus-copy" transform="translate(4.000000, 5.000000)" fill="#F0F4F8" fill-rule="nonzero">
+ <path d="M8.02048565,0 C8.66618192,0 9.16565924,0.333333333 9.51891759,1 L10.8,3.83333333 L22.0794975,3.83333333 C23.4049809,3.83333333 24,4.62508741 24,6.03648177 L24,20.9975166 C24,22.408911 23.4049809,23 22.0794975,23 L2,23 C0.6745166,23 0,22.408911 0,20.9975166 L0,2.00113218 C0,0.589737816 0.6745166,0 2,0 L8.02048565,0 L8.02048565,0 Z M6.45805361,2.99949054 L3.99467176,2.99949054 L3.99467176,2.99949054 C3.34390054,2.99949054 3.01851493,3.30237189 3.01851493,3.9081346 L3.01851493,13 L3.01851493,13 L21.0166975,13 L21.0166975,7.57306491 L21.0166975,7.57306491 C21.0166975,6.95482358 20.6778325,6.64570291 20.0001025,6.64570291 L9.49962531,6.64570291 L9.49962531,6.64570291 C9.08788539,6.64570291 8.76187861,6.33919388 8.52160496,5.7261758 L7.58317716,3.9081346 C7.21690437,3.30237189 6.84186318,2.99949054 6.45805361,2.99949054 Z" id="Combined-Shape" fill-opacity="0.16"></path>
+ <path d="M3,13.0005095 L20.9981825,13.0005095 C20.9981825,10.0007941 20.9981825,8.19181571 20.9981825,7.57357437 C20.9981825,6.95533304 20.6593175,6.64621238 19.9815875,6.64621238 C14.9229603,6.64621238 11.4228012,6.64621238 9.48111038,6.64621238 C9.06937046,6.64621238 8.74336367,6.33970334 8.50309002,5.72668526 L7.56466222,3.90864406 C7.19838943,3.30288135 6.82334825,3 6.43953867,3 C5.94161712,3 5.12048984,3 3.97615682,3 C3.32538561,3 3,3.30288135 3,3.90864406 C3,6.86935877 3,9.89998058 3,13.0005095 Z" id="Path-3-Copy" fill-opacity="0.04"></path>
+ </g>
+ </g>
+</svg>
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="32px" height="32px" viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <!-- Generator: Sketch 59.1 (86144) - https://sketch.com -->
+ <title>folder_dark</title>
+ <desc>Created with Sketch.</desc>
+ <g id="folder_dark" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" fill-opacity="0.16">
+ <g id="folder-plus" transform="translate(4.000000, 5.000000)" fill="#F0F4F8">
+ <path d="M24,20.9975166 C24,22.408911 23.4049809,23 22.0794975,23 L2,23 C0.6745166,23 0,22.408911 0,20.9975166 L0,2.00113218 C0,0.589737816 0.6745166,0 2,0 C4.48488653,0 6.49171508,0 8.02048565,0 C8.66618192,0 9.16565924,0.333333333 9.51891759,1 L10.8,3.83333333 L22.0794975,3.83333333 C23.4049809,3.83333333 24,4.62508741 24,6.03648177 L24,20.9975166 Z" id="Shape"></path>
+ </g>
+ </g>
+</svg>
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="32px" height="32px" viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <!-- Generator: Sketch 59.1 (86144) - https://sketch.com -->
+ <title>git_dark</title>
+ <desc>Created with Sketch.</desc>
+ <g id="git_dark" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" fill-opacity="0.16">
+ <g id="git-branch" transform="translate(5.000000, 5.000000)" fill="#F0F4F8" fill-rule="nonzero">
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="32px" height="32px" viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <!-- Generator: Sketch 59.1 (86144) - https://sketch.com -->
+ <title>hash_dark</title>
+ <desc>Created with Sketch.</desc>
+ <g id="hash_dark" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" fill-opacity="0.16">
+ <g id="hash" transform="translate(6.000000, 5.000000)" fill="#F0F4F8" fill-rule="nonzero">
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="32px" height="32px" viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <!-- Generator: Sketch 59.1 (86144) - https://sketch.com -->
+ <title>html_dark</title>
+ <desc>Created with Sketch.</desc>
+ <g id="html_dark" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" fill-opacity="0.16">
+ <g id="code" transform="translate(4.000000, 8.000000)" fill="#F0F4F8" fill-rule="nonzero">
+ <path d="M19.8786797,8 L14.9393398,3.06066017 C14.3535534,2.47487373 14.3535534,1.52512627 14.9393398,0.939339828 C15.5251263,0.353553391 16.4748737,0.353553391 17.0606602,0.939339828 L23.0606602,6.93933983 C23.6464466,7.52512627 23.6464466,8.47487373 23.0606602,9.06066017 L17.0606602,15.0606602 C16.4748737,15.6464466 15.5251263,15.6464466 14.9393398,15.0606602 C14.3535534,14.4748737 14.3535534,13.5251263 14.9393398,12.9393398 L19.8786797,8 Z" id="Shape"></path>
+ <path d="M4.12132034,8 L9.06066017,12.9393398 C9.64644661,13.5251263 9.64644661,14.4748737 9.06066017,15.0606602 C8.47487373,15.6464466 7.52512627,15.6464466 6.93933983,15.0606602 L0.939339828,9.06066017 C0.353553391,8.47487373 0.353553391,7.52512627 0.939339828,6.93933983 L6.93933983,0.939339828 C7.52512627,0.353553391 8.47487373,0.353553391 9.06066017,0.939339828 C9.64644661,1.52512627 9.64644661,2.47487373 9.06066017,3.06066017 L4.12132034,8 Z" id="Shape"></path>
+ </g>
+ </g>
+</svg>
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="32px" height="32px" viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <!-- Generator: Sketch 59.1 (86144) - https://sketch.com -->
+ <title>image_dark</title>
+ <desc>Created with Sketch.</desc>
+ <g id="image_dark" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
+ <g id="image-(1)" transform="translate(4.000000, 4.000000)">
+ <path d="M3.59930712,20.2991243 L15.3307812,8.92314941 C15.9126117,8.3589502 16.8373883,8.3589502 17.4192188,8.92314941 L20.5,11.9105736 L20.5,4 C20.5,3.72385763 20.2761424,3.5 20,3.5 L4,3.5 C3.72385763,3.5 3.5,3.72385763 3.5,4 L3.5,20 C3.5,20.1121678 3.53693532,20.2157088 3.59930712,20.2991243 L3.59930712,20.2991243 Z M7.70159593,20.5 L20,20.5 C20.2761424,20.5 20.5,20.2761424 20.5,20 L20.5,16.0894264 L16.375,12.0894264 L7.70159593,20.5 Z M23.5,15.4528564 L23.5,15.4565239 L23.5,20 C23.5,21.9329966 21.9329966,23.5 20,23.5 L4.0019785,23.5 L3.99783279,23.5 C2.06583227,23.4988286 0.5,21.9322742 0.5,20 L0.5,4 C0.5,2.06700338 2.06700338,0.5 4,0.5 L20,0.5 C21.9329966,0.5 23.5,2.06700338 23.5,4 L23.5,15.4528564 L23.5,15.4528564 Z" id="Shape" fill-opacity="0.16" fill="#F0F4F8" fill-rule="nonzero"></path>
+ <circle id="Oval" stroke-opacity="0.16" stroke="#F0F4F8" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" cx="8.5" cy="8.5" r="1"></circle>
+ </g>
+ </g>
+</svg>
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="32px" height="32px" viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <!-- Generator: Sketch 59.1 (86144) - https://sketch.com -->
+ <title>info_dark</title>
+ <desc>Created with Sketch.</desc>
+ <g id="info_dark" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
+ <g id="info" transform="translate(16.000000, 12.000000)"></g>
+ <circle id="Oval" stroke-opacity="0.16" stroke="#F0F4F8" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" cx="16" cy="16" r="10"></circle>
+ <circle id="Oval-2" fill-opacity="0.16" fill="#F0F4F8" fill-rule="nonzero" cx="16" cy="11.5" r="1.5"></circle>
+ <line x1="16" y1="20.5" x2="16" y2="16.5" id="Shape" stroke-opacity="0.16" stroke="#F0F4F8" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"></line>
+ </g>
+</svg>
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="32px" height="32px" viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <!-- Generator: Sketch 59.1 (86144) - https://sketch.com -->
+ <title>lock_dark</title>
+ <desc>Created with Sketch.</desc>
+ <g id="lock_dark" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" fill-opacity="0.16">
+ <g id="lock" transform="translate(5.000000, 4.000000)" fill="#F0F4F8" fill-rule="nonzero">
+ <path d="M4.5,9.5 L4.5,7 C4.5,3.41014913 7.41014913,0.5 11,0.5 C14.5898509,0.5 17.5,3.41014913 17.5,7 L17.5,9.5 L18,9.5 C19.9329966,9.5 21.5,11.0670034 21.5,13 L21.5,20 C21.5,21.9329966 19.9329966,23.5 18,23.5 L4,23.5 C2.06700338,23.5 0.5,21.9329966 0.5,20 L0.5,13 C0.5,11.0670034 2.06700338,9.5 4,9.5 L4.5,9.5 Z M7.5,9.5 L14.5,9.5 L14.5,7 C14.5,5.06700338 12.9329966,3.5 11,3.5 C9.06700338,3.5 7.5,5.06700338 7.5,7 L7.5,9.5 Z M4,12.5 C3.72385763,12.5 3.5,12.7238576 3.5,13 L3.5,20 C3.5,20.2761424 3.72385763,20.5 4,20.5 L18,20.5 C18.2761424,20.5 18.5,20.2761424 18.5,20 L18.5,13 C18.5,12.7238576 18.2761424,12.5 18,12.5 L4,12.5 Z" id="Shape"></path>
+ </g>
+ </g>
+</svg>
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="32px" height="32px" viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <!-- Generator: Sketch 59.1 (86144) - https://sketch.com -->
+ <title>package_dark</title>
+ <desc>Created with Sketch.</desc>
+ <g id="package_dark" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" fill-opacity="0.16">
+ <g id="package" transform="translate(4.000000, 3.000000)" fill="#F0F4F8" fill-rule="nonzero">
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="32px" height="32px" viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <!-- Generator: Sketch 59.1 (86144) - https://sketch.com -->
+ <title>prettier_dark</title>
+ <desc>Created with Sketch.</desc>
+ <g id="prettier_dark" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
+ <g id="Group" transform="translate(5.000000, 5.000000)" fill="#F0F4F8" fill-rule="nonzero">
+ <rect id="Rectangle-4" fill-opacity="0.16" x="0" y="0" width="9" height="3" rx="1.5"></rect>
+ <rect id="Rectangle-4-Copy" fill-opacity="0.16" x="0" y="6" width="5" height="3" rx="1.5"></rect>
+ <rect id="Rectangle-4-Copy-4" fill-opacity="0.16" x="11" y="0" width="4" height="3" rx="1.5"></rect>
+ <rect id="Rectangle-4-Copy-5" fill-opacity="0.16" x="7" y="6" width="3" height="3" rx="1.5"></rect>
+ <rect id="Rectangle-4-Copy-10" fill-opacity="0.06" x="17" y="0" width="5" height="3" rx="1.5"></rect>
+ <rect id="Rectangle-4-Copy-12" fill-opacity="0.06" x="20" y="6" width="2" height="3" rx="1"></rect>
+ <rect id="Rectangle-4-Copy-13" fill-opacity="0.06" x="17" y="12" width="5" height="3" rx="1.5"></rect>
+ <rect id="Rectangle-4-Copy-11" fill-opacity="0.06" x="9" y="18" width="13" height="3" rx="1.5"></rect>
+ <rect id="Rectangle-4-Copy-8" fill-opacity="0.16" x="12" y="6" width="6" height="3" rx="1.5"></rect>
+ <rect id="Rectangle-4-Copy-2" fill-opacity="0.16" x="0" y="12" width="4" height="3" rx="1.5"></rect>
+ <rect id="Rectangle-4-Copy-6" fill-opacity="0.16" x="6" y="12" width="9" height="3" rx="1.5"></rect>
+ <rect id="Rectangle-4-Copy-3" fill-opacity="0.16" x="0" y="18" width="7" height="3" rx="1.5"></rect>
+ </g>
+ </g>
+</svg>
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="32px" height="32px" viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <!-- Generator: Sketch 59.1 (86144) - https://sketch.com -->
+ <title>settings_dark</title>
+ <desc>Created with Sketch.</desc>
+ <g id="settings_dark" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" fill-opacity="0.16">
+ <g id="settings" transform="translate(4.000000, 4.000000)" fill="#F0F4F8">
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="32px" height="32px" viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <!-- Generator: Sketch 59.1 (86144) - https://sketch.com -->
+ <title>terminal_dark</title>
+ <desc>Created with Sketch.</desc>
+ <g id="terminal_dark" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" fill-opacity="0.16">
+ <path d="M9,4 L23,4 C25.7614237,4 28,6.23857625 28,9 L28,23 C28,25.7614237 25.7614237,28 23,28 L9,28 C6.23857625,28 4,25.7614237 4,23 L4,9 C4,6.23857625 6.23857625,4 9,4 Z M16.5,23 L22.5,23 C23.3284271,23 24,22.3284271 24,21.5 C24,20.6715729 23.3284271,20 22.5,20 L16.5,20 C15.6715729,20 15,20.6715729 15,21.5 C15,22.3284271 15.6715729,23 16.5,23 Z M11.4930676,15.5 L8.37888602,19.0034542 C7.828509,19.6226284 7.88428009,20.570737 8.50345424,21.121114 C9.12262839,21.671491 10.070737,21.6157199 10.621114,20.9965458 L14.621114,16.4965458 C15.1262953,15.9282167 15.1262953,15.0717833 14.621114,14.5034542 L10.621114,10.0034542 C10.070737,9.38428009 9.12262839,9.328509 8.50345424,9.87888602 C7.88428009,10.429263 7.828509,11.3773716 8.37888602,11.9965458 L11.4930676,15.5 Z" id="Shape" fill="#F0F4F8" fill-rule="nonzero"></path>
+ </g>
+</svg>
@@ -342,8 +342,6 @@ pub struct LanguageConfig {
pub block_comment: Option<(Arc<str>, Arc<str>)>,
#[serde(default)]
pub overrides: HashMap<String, LanguageConfigOverride>,
- #[serde(default)]
- pub icon_path: Option<Arc<str>>,
}
#[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<Self>, suffix: &str) -> Option<Arc<str>> {
- 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<Self>,
string: &str,
@@ -2474,10 +2474,6 @@ impl Project {
})
}
- pub fn icon_for_path(&self, path: &Path) -> Option<Arc<str>> {
- self.languages.icon_for_suffix(path.extension()?.to_str()?)
- }
-
fn detect_language_for_buffer(
&mut self,
buffer_handle: &ModelHandle<Buffer>,
@@ -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" }
@@ -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<str>,
+}
+
+#[derive(Deserialize, Debug)]
+pub struct FileAssociations {
+ suffixes: HashMap<String, String>,
+ types: HashMap<String, TypeConfig>,
+}
+
+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::<FileAssociations>(str::from_utf8(&file).unwrap()).unwrap()
+ }
+
+ pub fn get_icon(path: &Path, cx: &AppContext) -> Option<Arc<str>> {
+ if !cx.has_global::<Self>() {
+ return None;
+ }
+
+ let this = cx.global::<Self>();
+ 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<Arc<str>> {
+ if !cx.has_global::<Self>() {
+ return None;
+ }
+
+ let this = cx.global::<Self>();
+
+ let key = if expanded {
+ EXPANDED_DIRECTORY_TYPE
+ } else {
+ DIRECTORY_TYPE
+ };
+
+ this.types
+ .get(key)
+ .map(|type_config| type_config.icon.clone())
+ }
+}
@@ -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<Project>,
@@ -131,8 +132,9 @@ pub fn init_settings(cx: &mut AppContext) {
settings::register::<ProjectPanelSettings>(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);
});
@@ -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,
}
@@ -1,6 +1,5 @@
name = "TOML"
path_suffixes = ["toml"]
-icon_path = "icons/radix/gear.svg"
line_comment = "# "
autoclose_before = ",]}"
brackets = [
@@ -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);
@@ -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
@@ -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: {