Skip to content

Commit 8614405

Browse files
hassoncsmrubens
andauthored
Auto-reload core changes in dev mode (#3284)
Co-authored-by: Matt Rubens <[email protected]>
1 parent 4283262 commit 8614405

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/extension.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,21 @@ export async function activate(context: vscode.ExtensionContext) {
128128
// Implements the `RooCodeAPI` interface.
129129
const socketPath = process.env.ROO_CODE_IPC_SOCKET_PATH
130130
const enableLogging = typeof socketPath === "string"
131+
132+
// Watch the core files and automatically reload the extension host
133+
const enableCoreAutoReload = process.env?.NODE_ENV === "development"
134+
if (enableCoreAutoReload) {
135+
console.log(`♻️♻️♻️ Core auto-reloading is ENABLED!`)
136+
const watcher = vscode.workspace.createFileSystemWatcher(
137+
new vscode.RelativePattern(context.extensionPath, "src/**/*.ts"),
138+
)
139+
watcher.onDidChange((uri) => {
140+
console.log(`♻️ File changed: ${uri.fsPath}. Reloading host…`)
141+
vscode.commands.executeCommand("workbench.action.reloadWindow")
142+
})
143+
context.subscriptions.push(watcher)
144+
}
145+
131146
return new API(outputChannel, provider, socketPath, enableLogging)
132147
}
133148

0 commit comments

Comments
 (0)