Skip to content

VS Code Extension

The Reacton State Management VS Code extension provides full IDE support for Reacton projects: code lens, hover information, diagnostics, dependency graph visualization, code snippets, explorer sidebar, and widget wrapping commands.

Installation

From the VS Code Marketplace

  1. Open VS Code
  2. Go to the Extensions view (Cmd+Shift+X / Ctrl+Shift+X)
  3. Search for "Reacton State Management"
  4. Click Install

From a VSIX File

bash
code --install-extension reacton-vscode-0.1.0.vsix

Building from Source

bash
cd extensions/reacton_vscode
npm install
npm run compile

Requirements

  • VS Code 1.80 or later
  • A Flutter or Dart project with reacton or flutter_reacton in pubspec.yaml

The extension activates automatically when a pubspec.yaml file is detected in the workspace.


Code Lens

Inline annotations appear above every Reacton declaration, providing at-a-glance metadata without leaving the editor.

Each Code Lens row displays:

ItemDescription
Type informationThe Reacton kind (Writable, Computed, Async, Family, Selector, Effect, or State Machine)
Dependency countNumber and names of Reactons this declaration depends on
Subscriber countHow many other Reactons subscribe to this declaration
Show in GraphClick to open the interactive dependency graph with this Reacton highlighted
Find ReferencesClick to find all usages of this Reacton across the workspace

Hover Information

Hovering over any Reacton name (declaration or reference) displays a rich tooltip:

FieldDescription
TypeThe Reacton kind (e.g., Writable Reacton, Computed Reacton)
Value TypeThe Dart generic type parameter (e.g., int, List<String>)
Doc CommentAny /// documentation comments above the declaration
DependenciesList of Reactons this declaration reads from, with their types
SubscribersList of Reactons that depend on this declaration
File LocationClickable link to the source file and line number
Graph Link"Show in Graph" action to open the dependency graph

Diagnostics

Five built-in diagnostic rules detect common anti-patterns and potential bugs in real time. Diagnostics appear as squiggly underlines in the editor, in the Problems panel, and in the minimap.

CodeSeverityDescription
reacton-missing-nameWarningA Reacton declaration is missing the name parameter. Adding a name improves debugging and DevTools experience.
reacton-in-buildErrorreacton(), computed(), or asyncReacton() is called inside a build() method. This creates a new Reacton on every rebuild.
reacton-circular-dependencyErrorA circular dependency exists between two or more Reactons. Detected via iterative DFS on the full dependency graph.
reacton-unusedHintA Reacton is declared but never referenced. Effects are excluded from this rule. Unused Reactons are rendered with a faded style.
reacton-too-many-watchersInformationA single build() method contains 3+ context.watch() calls. Consider combining into a computed() Reacton.

Dependency Graph

An interactive, canvas-based visualization of the entire Reacton dependency graph in your workspace. Open it with Cmd+Shift+G / Ctrl+Shift+G or by clicking the status bar item.

Color Coding

ColorType
Blue (#4fc3f7)Writable Reacton
Green (#81c784)Computed Reacton
Orange (#ffb74d)Async Reacton
Purple (#ce93d8)Family
Pink (#f06292)Selector
Red (#ef5350)Effect
Violet (#7e57c2)State Machine

Interactions

  • Filter by type -- Use the dropdown in the toolbar to show only a specific Reacton type
  • Search by name -- Type in the search field to filter nodes
  • Hover -- See a tooltip with name, type, value type, and dependencies
  • Click -- Select a node (highlighted with a solid border)
  • Double-click -- Navigate directly to its declaration in the editor
  • Legend -- Color legend in the bottom-right corner

The graph automatically re-renders on file save when reacton.autoRefreshGraph is enabled.


Snippets

The extension ships with 25 code snippets for Dart files, all using the r prefix.

Reacton Declarations

PrefixDescription
rreactonCreate a writable Reacton
rcomputedCreate a computed Reacton
rcomputedmCreate a computed Reacton with a multiline body
rasyncCreate an async Reacton
rfamilyCreate a Reacton family
reffectCreate a Reacton effect
rselectorCreate a Reacton selector
rstatemachineCreate a Reacton state machine
rqueryCreate a Reacton query

Flutter Widgets

PrefixDescription
rscopeWrap widget with ReactonScope
rbuilderCreate a ReactonBuilder widget
rconsumerCreate a ReactonConsumer widget
rlistenerCreate a ReactonListener widget
rselectorwCreate a ReactonSelector widget

Context Extensions

PrefixDescription
rwatchWatch a Reacton with context.watch()
rreadRead a Reacton with context.read()
rsetSet a Reacton value with context.set()
rupdateUpdate a Reacton value with context.update()

Architecture and Testing

PrefixDescription
rmiddlewareCreate a Reacton middleware class
rtestsetupSet up a TestReactonStore with setUp/tearDown
rawhenPattern match on AsyncValue with when()
rmoduleCreate a Reacton module class
rformCreate a Reacton form
rstoreCreate a ReactonStore instance
rimportImport package:reacton/reacton.dart
rimportfImport package:flutter_reacton/flutter_reacton.dart

Commands and Keybindings

Keyboard Shortcuts

macOSWindows/LinuxCommandDescription
Cmd+Shift+RCtrl+Shift+RGo to Reacton...Quick picker to search and navigate to any Reacton declaration
Cmd+Shift+GCtrl+Shift+GShow Dependency GraphOpen the interactive dependency graph panel

Command Palette Commands

Available from Cmd+Shift+P / Ctrl+Shift+P:

CommandDescription
Reacton: Show Dependency GraphOpen the interactive dependency graph
Reacton: Refresh Dependency GraphForce a full workspace re-scan and refresh
Reacton: Go to Reacton...Open quick picker for all Reacton declarations
Reacton: Show Dependency ChainView the full dependency chain for a selected Reacton in the Output panel
Reacton: Find All ReferencesFind all usages of a specific Reacton
Reacton: Wrap with ReactonBuilderWrap selected widget code with ReactonBuilder
Reacton: Wrap with ReactonConsumerWrap selected widget code with ReactonConsumer
Reacton: Wrap with ReactonScopeWrap selected widget code with ReactonScope

Context Menu

Right-click on selected code in a Dart file to access widget wrapping commands:

CommandWraps Selection With
Wrap with ReactonBuilderReactonBuilder<Type>(reacton: ..., builder: (context, value) { ... })
Wrap with ReactonConsumerReactonConsumer(builder: (context, ref) { ... })
Wrap with ReactonScopeReactonScope(store: ReactonStore(), child: ...)

Reacton Explorer Sidebar

The Reacton States tree view appears in the Explorer sidebar when a Reacton project is detected.

Features:

  • Grouped by type -- Reactons organized under collapsible headers: Reactons, Computed, Async, Families, Selectors, Effects, and State Machines. Each header shows a count.
  • Click to navigate -- Click any item to open its declaration in the editor
  • Rich tooltips -- Hover to see type, value type, file location, dependencies, subscribers, and doc comments
  • Expandable dependencies -- Reactons with dependencies can be expanded to show sub-items, each clickable
  • Toolbar actions -- Refresh button and graph button in the view title bar

Status Bar

A status bar item shows:

  • Idle: Total Reacton count (e.g., "12 Reactons")
  • Scanning: Spinner animation with "Scanning..."
  • Click: Opens the dependency graph
  • Tooltip: Count breakdown by Reacton type

Configuration

All settings are under the reacton.* namespace. Open Settings (Cmd+, / Ctrl+,) and search for "Reacton".

SettingTypeDefaultDescription
reacton.showCodeLensbooleantrueShow Code Lens annotations above Reacton declarations
reacton.showDiagnosticsbooleantrueShow diagnostics for common anti-patterns
reacton.showStatusBarbooleantrueShow the Reacton count in the status bar
reacton.autoRefreshGraphbooleantrueAuto-refresh the dependency graph and explorer on file save
reacton.graphLayoutstring"hierarchical"Layout algorithm: "hierarchical" or "force-directed"

Example settings.json:

json
{
  "reacton.showCodeLens": true,
  "reacton.showDiagnostics": true,
  "reacton.showStatusBar": true,
  "reacton.autoRefreshGraph": true,
  "reacton.graphLayout": "hierarchical"
}

What's Next

  • DevTools -- Runtime debugging from Flutter DevTools
  • CLI -- Command-line tools for Reacton
  • Lint Rules -- Analysis-time lint rules

Released under the MIT License.