Entwickler-Tools2024

React UI Component Browser

Ein-Klick-Komponenteneinfügung mit Auto-Imports, Live-Vorschau und organisierter Kategorie-Navigation.

rohith-a.me/projects/proj-4
01

Die Herausforderung

Entwickler benötigen eine schnelle Möglichkeit, React-UI-Komponenten zu durchsuchen, vorzuschauen und einzufügen, ohne den Editor zu verlassen.

02

Der Ansatz

Erstellung einer VS Code Erweiterung mit Baumansicht, Live-Webview-Vorschau, Schnell-Einfügen und automatischer Erkennung von Komponenten aus konfigurierbaren Pfaden.

Systemdesign

So ist React UI Component Browser aufgebaut

Die technische Architekturbeschreibung ist auf Englisch.

A VS Code extension that indexes a component folder on disk, previews components in a webview and writes import-aware code into the active editor.

commands
7
tree views + 1 webview
2

01 · VS Code UI

client

Components tree

tree view

client

Quick Snippets

tree view

client

Preview panel

webview

02 · Extension host

gateway

Extension host

7 commands

service

Component scanner

glob + prop parsing

service

Component inserter

merges imports

03 · Workspace

object store

Component folder

set in settings

client

Active editor

clientgatewayserviceobject store

8 connections

  • Components tree→Extension hostselect
  • Quick Snippets→Extension hostinsert snippet
  • Preview panel→Extension hostinsert · copy
  • Extension host→Preview panelrender · async
  • Extension host→Component scanner
  • Component scanner→Component folderglob · read
  • Extension host→Component inserter
  • Component inserter→Active editoredit + import

Request flow · Browsing and inserting a component

  1. 1The scanner globs the configured folder and parses each file’s props into the tree.
  2. 2Selecting a component opens the webview preview with its variants.
  3. 3Insert posts back to the host; the inserter adds the usage at the cursor and merges the import into an existing one when present.

Design decisions

Props from source
Props are parsed from the component files themselves, so the browser stays accurate without a separate manifest.
Import merging
Inserting a second component from the same module extends the existing import instead of adding a duplicate line.

Trade-offs & known limits

  • Prop parsing is pattern-based rather than a full TypeScript AST, so unusual prop declarations may be missed.

Haben Sie etwas Ähnliches vor?

Ich bin offen für Freelance- und Vertragsprojekte – lassen Sie uns über Ihr Vorhaben sprechen.