Skip to content

feat(theme): add in-memory theme set registration#9

Merged
BumpyClock merged 3 commits into
mainfrom
feat/theme-registry-api
Jul 17, 2026
Merged

feat(theme): add in-memory theme set registration#9
BumpyClock merged 3 commits into
mainfrom
feat/theme-registry-api

Conversation

@BumpyClock

Copy link
Copy Markdown
Owner

Summary

Adds ThemeRegistry::register_theme_set(&mut self, set: ThemeSet), letting callers hand a ThemeSet straight to the registry without writing it to themes_dir first.

gpui-component-app's ThemeSource::Bundled currently has to sync embedded themes out to config_dir because ThemeRegistry's only ingestion path is reading files from disk. This adds a direct path, which also unblocks a future wasm build with no filesystem.

Behavior

  • Registering a set overwrites any previous set with the same name (in-memory or previously loaded from disk).
  • Default themes are protected the same way reload() protects them: a registered theme can't replace a built-in theme of the same name.
  • If watch_dir later reloads a disk file with the same set name, the on-disk version wins on the next reload — registrations behave like a previously loaded file that disk can supersede.
  • global_mut on this fork notifies observers, so callers just use ThemeRegistry::global_mut(cx).register_theme_set(set).

reload() is refactored to share its merge logic with the new method via a rebuild_theme_sets helper, caching the last disk-loaded sets so registration doesn't need to touch the filesystem.

Test plan

  • cargo test -p gpui-component (186 passed, incl. 4 new registry tests)
  • cargo clippy -p gpui-component --all-targets -- --deny warnings
  • cargo fmt --check crates/ui/src/theme/registry.rs

ThemeSource::Bundled in gpui-component-app currently has to sync
embedded themes to config_dir before ThemeRegistry will pick them up,
since the only ingestion path is reading files from themes_dir. Add
ThemeRegistry::register_theme_set so callers can hand a ThemeSet
straight to the registry, unblocking bundled/embedded themes and a
future wasm build with no filesystem.

reload() is refactored to cache the disk-loaded sets and rebuild
themes/theme_sets from a shared helper, so a later watch_dir reload
with the same set name still wins over an in-memory registration.
@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 15 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 5ae4a2c2-0a27-4d1d-8a9b-b3e95c5b51e8

📥 Commits

Reviewing files that changed from the base of the PR and between 8be1306 and 97cb5b8.

📒 Files selected for processing (1)
  • crates/ui/src/theme/registry.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/theme-registry-api

Comment @coderabbitai help to get the list of available commands.

@BumpyClock
BumpyClock merged commit 27f6057 into main Jul 17, 2026
7 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