Repository navigation
Conversation
Package Version ReportThe following packages have been updated: |
There was a problem hiding this comment.
🟡 Changes recommended
Hot reload is handled by both the Dart adapter and daemon for attached Server sessions, causing duplicate and potentially overlapping operations on the same VM.
5 open issues
Prevent duplicate reload and restart handling · New Use the selected session’s daemon before the last-started daemon · New Require or negotiate CLI support for optional appId requests · New Wait for client-domain readiness and handle failed responses · New Report action success only after completion and propagate failures · New
What changed in this PR
This PR adds hot reload and hot restart controls to the Jaspr VS Code extension, connecting editor actions to the CLI development workflow.
Changes:
- Adds commands, keybindings, terminal controls, and debug-request tracking.
- Tracks running daemons and their associated debug sessions.
- Connects daemon reload/restart requests to workflow actions and adds protocol response tests.
| File | Description |
|---|---|
packages/jaspr_cli/test/src/commands/daemon_command_test.dart |
Adds reload and restart response assertions. |
packages/jaspr_cli/lib/src/dev/client_domain.dart |
Adds reload handling and workflow callbacks with progress reporting. |
packages/jaspr_cli/lib/src/commands/dev_command.dart |
Extracts shared reload/restart triggers and build queueing. |
packages/jaspr_cli/lib/src/commands/daemon_command.dart |
Connects client-domain requests to workflow triggers. |
modules/jaspr-code/src/jaspr/serve_daemon.ts |
Adds daemon tracking, request sending, and terminal controls. |
modules/jaspr-code/src/extension.ts |
Registers reload/restart commands and the debug tracker. |
modules/jaspr-code/src/debug.ts |
Forwards observed debug reload/restart requests to the daemon. |
modules/jaspr-code/package.json |
Declares commands, conditional menu entries, and keybindings. |
Review effort: Balanced
| if (message.command === "hotReload") { | ||
| daemon.reload(); |
There was a problem hiding this comment.
This does seem accurate.
| if (this.activeDaemon && this.activeDaemon.status === "running") { | ||
| return this.activeDaemon; | ||
| } | ||
| const activeSession = vscode.debug.activeDebugSession; | ||
| if (activeSession?.configuration?._processId) { | ||
| const daemon = this.getDaemonByProcessId( | ||
| activeSession.configuration._processId | ||
| ); | ||
| if (daemon && daemon.status === "running") { | ||
| return daemon; | ||
| } | ||
| } |
| return; | ||
| } | ||
| this.lastReloadTime = now; | ||
| this.sendRequest("client.restart", { fullRestart: false }); |
There was a problem hiding this comment.
Seems valid. Would be unfortunate to drop support for earlier versions already though. Perhaps can use and check the protocolVersion from the CLI's DaemonDomain?
| if (this.status !== "running" || !this.process) { | ||
| return; | ||
| } |
| 'appId': ?appId, | ||
| 'log': '${fullRestart ? 'Restarted' : 'Reloaded'} application in ${stopwatch.elapsedMilliseconds}ms', | ||
| }); | ||
| return {'code': 0}; |
| "when": "inDebugMode && jaspr:isRunning && !editorTextFocus" | ||
| }, | ||
| { | ||
| "command": "jaspr.hotRestart", | ||
| "key": "shift+r", | ||
| "when": "inDebugMode && jaspr:isRunning && !editorTextFocus" |
There was a problem hiding this comment.
Should these conditions be inputFocus instead of editorTextFocus, so they don't trigger in other inputs like "Find"?
| "when": "inDebugMode && jaspr:isRunning && !editorTextFocus" | |
| }, | |
| { | |
| "command": "jaspr.hotRestart", | |
| "key": "shift+r", | |
| "when": "inDebugMode && jaspr:isRunning && !editorTextFocus" | |
| "when": "inDebugMode && jaspr:isRunning && !inputFocus" | |
| }, | |
| { | |
| "command": "jaspr.hotRestart", | |
| "key": "shift+r", | |
| "when": "inDebugMode && jaspr:isRunning && !inputFocus" |
| if (message.command === "hotReload") { | ||
| daemon.reload(); |
There was a problem hiding this comment.
This does seem accurate.
| if (this.activeDaemon && this.activeDaemon.status === "running") { | ||
| return this.activeDaemon; | ||
| } | ||
| const activeSession = vscode.debug.activeDebugSession; | ||
| if (activeSession?.configuration?._processId) { | ||
| const daemon = this.getDaemonByProcessId( | ||
| activeSession.configuration._processId | ||
| ); | ||
| if (daemon && daemon.status === "running") { | ||
| return daemon; | ||
| } | ||
| } |
| return; | ||
| } | ||
| this.lastReloadTime = now; | ||
| this.sendRequest("client.restart", { fullRestart: false }); |
There was a problem hiding this comment.
Seems valid. Would be unfortunate to drop support for earlier versions already though. Perhaps can use and check the protocolVersion from the CLI's DaemonDomain?
| final Future<void> Function()? onReload; | ||
| final Future<void> Function()? onRestart; |
There was a problem hiding this comment.
Is there any time these won't exist/be specified? At least currently it seems they're always specified and a lot of code in _restart could be simplified if they become required.


Description
Update VSCode Extension to support hotreload and latest Jaspr version.
Type of Change
Ready Checklist
the semantic_changelog format.
///).