From 8614405144dc916432c901ad9e73d115f572b6f6 Mon Sep 17 00:00:00 2001 From: Chris Hasson Date: Tue, 20 May 2025 11:51:38 -0700 Subject: [PATCH] Auto-reload core changes in dev mode (#3284) Co-authored-by: Matt Rubens --- src/extension.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/extension.ts b/src/extension.ts index d26d71bea7..34248619d6 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -128,6 +128,21 @@ export async function activate(context: vscode.ExtensionContext) { // Implements the `RooCodeAPI` interface. const socketPath = process.env.ROO_CODE_IPC_SOCKET_PATH const enableLogging = typeof socketPath === "string" + + // Watch the core files and automatically reload the extension host + const enableCoreAutoReload = process.env?.NODE_ENV === "development" + if (enableCoreAutoReload) { + console.log(`♻️♻️♻️ Core auto-reloading is ENABLED!`) + const watcher = vscode.workspace.createFileSystemWatcher( + new vscode.RelativePattern(context.extensionPath, "src/**/*.ts"), + ) + watcher.onDidChange((uri) => { + console.log(`♻️ File changed: ${uri.fsPath}. Reloading host…`) + vscode.commands.executeCommand("workbench.action.reloadWindow") + }) + context.subscriptions.push(watcher) + } + return new API(outputChannel, provider, socketPath, enableLogging) }