Dioxus CSS Peek
Peek, Go to Definition (F12 / Cmd+Click), Hover preview, Autocomplete, and Workspace Symbol search for CSS, SCSS, and Less selectors and custom properties inside Dioxus rsx! Rust files.
Built specifically for Dioxus's curly-brace + colon macro DSL (div { class: "my-btn", id: "hero" }) where HTML-only CSS peek extensions fail to match selectors.
Features
- Dioxus
rsx! Selector Resolution
- Standard attributes:
div { class: "set-nav-label", id: "settings-title" }
- Multi-class strings:
span { class: "muted set-lead" } — resolves the exact class word under your cursor
- Conditional
if / else and match branches on elements and custom #[component] props:
Button {
class: if selected { "set-nav-item on" } else { "set-nav-item" },
}
- Local Rust variable bindings passed to
class: / id::
let body_class = if is_shortcuts { "set-body set-shortcuts" } else { "set-body" };
rsx! { div { class: body_class } }
- Skips
{interpolation} segments inside formatted class strings ("btn btn-{tone} active") so rust-analyzer continues to handle Rust expressions seamlessly
- Also supports HTML-like Rust templates (
class="..." in Yew / Leptos and class:active=... directives in Leptos)
- CSS Custom Properties (
--var)
- Go to definition, hover preview, and completion for
var(--accent-color) inside style: "..."
- Multi-Crate Workspace Stylesheet Indexing
- Automatically indexes
.css, .scss, and .less across Cargo workspace crates (skipping target/, node_modules/, .git/)
- Resolves nested CSS / SCSS
& selectors (e.g. .set-nav { &-item { &.on { ... } } } -> .set-nav-item, .set-nav-item.on, .on) and @media / @container / @layer blocks
- Ranks definitions in the nearest crate directory first
- Rich Hover & Dedicated CSS-Only Peek Command
- Hovering any class, ID, or
--var renders matching CSS rules with clickable path/to/file.css:line links and a one-click Peek CSS action (Dioxus CSS Peek: Peek / Go to CSS Definition Only) that opens inline Peek without proc-macro noise from #[component] / derive_props
- Autocomplete & Workspace Symbols
- Suggests classes, IDs, and
--var names inside rsx! strings and exposes selectors to Cmd+T / Ctrl+T Workspace Symbol search
Configuration
| Setting |
Default |
Description |
dioxusCssPeek.enable |
true |
Enable or disable Dioxus CSS Peek |
dioxusCssPeek.languages |
["rust"] |
Language IDs where Dioxus CSS Peek is active |
dioxusCssPeek.include |
["**/*.{css,scss,less}"] |
Glob patterns for discovering workspace stylesheets |
dioxusCssPeek.exclude |
["**/target/**", "**/node_modules/**", "**/.git/**", "**/dist/**", "**/build/**", "**/out/**"] |
Glob patterns excluded from indexing |
dioxusCssPeek.classAttributes |
["class", "class_name", "classes"] |
Attribute names treated as CSS class lists |
dioxusCssPeek.idAttributes |
["id"] |
Attribute names treated as CSS element IDs |
dioxusCssPeek.enableHover |
true |
Show matching CSS rules and file links on hover |
dioxusCssPeek.enableCompletion |
true |
Provide selector and variable completions in strings |
dioxusCssPeek.maxHoverRules |
6 |
Maximum CSS rules shown per hover card |
Commands
Dioxus CSS Peek: Peek / Go to CSS Definition Only (dioxusCssPeek.goToStyle) — Jump directly to or peek matching CSS definitions without Rust proc-macro results.
Dioxus CSS Peek: Reindex Workspace Stylesheets (dioxusCssPeek.reindex) — Manually rescan all workspace stylesheets.
Development & Packaging
npm test
npm run package
License
MIT
| |