📋 Summary
Create a VSCode extension that streamlines working with Reflex (or similar pub/sub) event IDs. It should:
- Generate new event/subscription IDs and insert them into the shared
event-ids.ts / sub-ids.ts files.
- Provide “Go to implementation” navigation:
- From a
dispatch('someId') call jump to the matching regEvent('someId', …) handler.
- From a
useSubscription('someId') call jump to the matching regSub('someId', …) handler.
- From a
regEvent('someId', …)/regSub declaration jump to all dispatch/useSubscription points.
🎯 Goals
- Reduce friction when adding new events or subscriptions.
- Enable one-click navigation between dispatch calls and handler registrations.
- Keep modules decoupled (no need to import handlers into the UI just for navigation).
✍️ User Stories
-
As a developer, when I type Reflex: Create new event… in the Command Palette, I can enter a new ID ("todos/add") and have:
- A new entry appended under
export const EVENT_IDS = { … } in src/events.ts, and
- A stub
regEvent('todos/add', (ctx) => { /* TODO */ }) injected into src/events.ts (or into a designated handlers.ts).
-
As a developer, when I place the cursor on dispatch('todos/add') and press F12 (Go to Definition), I am taken to the matching regEvent('todos/add', …) stub.
-
As a developer, when I place the cursor on regEvent('todos/add', …) and press “Find All References”, I see all dispatch('todos/add') and useSubscription(['todos/add']) usages.
🛠 Technical Requirements
-
Command Palette integration
reflex.createEventId
- Prompt: “Enter new event ID”
- Inserts into
src/events.ts under the EVENT_IDS object (maintain sorted order or append).
- Creates or updates a stub
regEvent call in src/events.ts (or in a separate handlers.ts).
-
Definition Provider
- For any string literal argument matching the pattern of a registered ID, hook into VSCode’s Go To Definition to route from
dispatch(id) or useSubscription([id]) to the corresponding regEvent(id, handler) location.
-
Reference Provider
- From the
regEvent(id, …) location, support “Find All References” to list every dispatch(id, …) and useSubscription([id]) occurrence.
-
Configuration
- Let users configure:
- Path/glob for their
events.ts and subscriptions.ts (defaults: src/events.ts, src/subscriptions.ts).
- Naming conventions for constants vs plain strings.
-
Robustness
- Should handle both string-literal unions and
as const–based ID definitions.
- Support TypeScript and JavaScript workspaces.
✅ Acceptance Criteria
📋 Summary
Create a VSCode extension that streamlines working with Reflex (or similar pub/sub) event IDs. It should:
event-ids.ts/sub-ids.tsfiles.dispatch('someId')call jump to the matchingregEvent('someId', …)handler.useSubscription('someId')call jump to the matchingregSub('someId', …)handler.regEvent('someId', …)/regSubdeclaration jump to all dispatch/useSubscription points.🎯 Goals
✍️ User Stories
As a developer, when I type
Reflex: Create new event…in the Command Palette, I can enter a new ID ("todos/add") and have:export const EVENT_IDS = { … }insrc/events.ts, andregEvent('todos/add', (ctx) => { /* TODO */ })injected intosrc/events.ts(or into a designatedhandlers.ts).As a developer, when I place the cursor on
dispatch('todos/add')and press F12 (Go to Definition), I am taken to the matchingregEvent('todos/add', …)stub.As a developer, when I place the cursor on
regEvent('todos/add', …)and press “Find All References”, I see alldispatch('todos/add')anduseSubscription(['todos/add'])usages.🛠 Technical Requirements
Command Palette integration
reflex.createEventIdsrc/events.tsunder theEVENT_IDSobject (maintain sorted order or append).regEventcall insrc/events.ts(or in a separatehandlers.ts).Definition Provider
dispatch(id)oruseSubscription([id])to the correspondingregEvent(id, handler)location.Reference Provider
regEvent(id, …)location, support “Find All References” to list everydispatch(id, …)anduseSubscription([id])occurrence.Configuration
events.tsandsubscriptions.ts(defaults:src/events.ts,src/subscriptions.ts).Robustness
as const–based ID definitions.✅ Acceptance Criteria
regEvent(...)is created or updated without breaking existing code.dispatch(id)jumps directly to itsregEvent(id, …)handler.regEvent(id, …)shows every dispatch/useSubscription usage.as const).