Skip to content

feat: file-type icons in the sidebar file tree#6

Merged
fredclausen merged 1 commit into
mainfrom
file-type-icons
Jun 30, 2026
Merged

feat: file-type icons in the sidebar file tree#6
fredclausen merged 1 commit into
mainfrom
file-type-icons

Conversation

@fredclausen

Copy link
Copy Markdown
Member

What

Adds Catppuccin Mocha file-type icons next to files and folders in the workspace sidebar, the way editors like Zed do it: SVG assets plus an extension/name lookup table, rather than icons baked into the colour theme.

How

  • Vendored the Catppuccin Mocha icon set (623 SVGs) under assets/file-icons/mocha/, pinned to upstream commit 6d953c8, with an MIT attribution file.
  • Generated the suffix / full-name / named-directory lookup tables (file_icon_table.rs) and the compile-time embed table (file_icon_bytes.rs) from the upstream icon-theme manifest.
  • file_icon module holds the runtime resolution (full-name rules win, then longest trailing dotted suffix, else a generic icon; folders match case-insensitively with open/closed variants) so it stays unit-testable.
  • egui_extras (svg feature, pinned 0.35.0 to match egui/eframe) renders the embedded SVGs; loaders are installed once at startup.
  • tree_dir now draws an icon before each file and folder (folders switched to CollapsingState so the icon sits in the header).
  • Vendored assets and generated tables are excluded from the pre-commit lint set via flake.nix extraExcludes (third-party / machine-generated).

Notes / tradeoffs

  • This pulls in resvg/usvg/tiny-skia for SVG rendering, which grows the dependency tree — the deliberate cost of the colourful-SVG approach over a monochrome Nerd Font glyph approach.
  • The icons are pure-vector (no <text>), so the lighter svg feature suffices; no system-font dependency.

Verification

cargo fmt --check, cargo clippy --all-targets --all-features -D warnings, cargo test --all (87 pass, +11 new), and cargo machete all green in the Nix dev shell. Release build compiles.

Render Catppuccin Mocha file-type icons next to files and folders in the
workspace sidebar, mirroring the icon-theme approach editors like Zed use
(SVG assets plus an extension/name lookup, rather than icons baked into
the colour theme).

The Catppuccin Mocha icon set is vendored under assets/file-icons/ and
embedded at compile time. The suffix/stem/named-directory lookup tables
and the embed table are generated from the upstream icon-theme manifest;
the runtime resolution lives in the file_icon module so it stays
testable. egui_extras (svg feature) renders the embedded SVGs.

The vendored assets and the generated lookup tables are excluded from
the pre-commit lint set (they are third-party / machine-generated).
@fredclausen
fredclausen merged commit 165c6e7 into main Jun 30, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant