feat: file-type icons in the sidebar file tree#6
Merged
Conversation
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).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
assets/file-icons/mocha/, pinned to upstream commit6d953c8, with an MIT attribution file.file_icon_table.rs) and the compile-time embed table (file_icon_bytes.rs) from the upstream icon-theme manifest.file_iconmodule 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, pinned0.35.0to match egui/eframe) renders the embedded SVGs; loaders are installed once at startup.tree_dirnow draws an icon before each file and folder (folders switched toCollapsingStateso the icon sits in the header).flake.nixextraExcludes(third-party / machine-generated).Notes / tradeoffs
resvg/usvg/tiny-skiafor SVG rendering, which grows the dependency tree — the deliberate cost of the colourful-SVG approach over a monochrome Nerd Font glyph approach.<text>), so the lightersvgfeature suffices; no system-font dependency.Verification
cargo fmt --check,cargo clippy --all-targets --all-features -D warnings,cargo test --all(87 pass, +11 new), andcargo macheteall green in the Nix dev shell. Release build compiles.