From 6aa16f113c30d07ef34eeb1fee950206e059472e Mon Sep 17 00:00:00 2001 From: Nick Bolton Date: Mon, 16 Jun 2025 09:07:09 +0100 Subject: [PATCH 1/2] refactor: rename command from 'showRoomId' to 'configure' for clarity --- package.json | 4 ++-- src/extension.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 2243916..bd9535b 100644 --- a/package.json +++ b/package.json @@ -25,8 +25,8 @@ "title": "Multi-Build: Reconnect" }, { - "command": "multiBuild.showRoomId", - "title": "Multi-Build: Show/Edit Room ID" + "command": "multiBuild.configure", + "title": "Multi-Build: Configure" } ], "configuration": { diff --git a/src/extension.ts b/src/extension.ts index fa312a4..1e3d005 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -11,7 +11,7 @@ const serverConfigKey = "multiBuild.server"; const syncDataConfigKey = "multiBuild.syncData"; const reconnectCommand = `multiBuild.reconnect`; const syncCommand = `multiBuild.sync`; -const showRoomIdCommand = "multiBuild.showRoomId"; +const configureCommand = "multiBuild.configure"; const defaultBaseUrl = "wss://multi-build-server.symless.workers.dev"; const keepAliveIntervalMillis = 10000; // 10 seconds @@ -49,7 +49,7 @@ export function activate(context: vscode.ExtensionContext) { // Register command to show and edit the current room ID context.subscriptions.push( - vscode.commands.registerCommand(showRoomIdCommand, async () => { + vscode.commands.registerCommand(configureCommand, async () => { const config = await getServerConfig(); const roomId = await showRoomIdPrompt(config.roomId); if (roomId !== config.roomId) { From 378538d096f6ebe64f681b458b6abfd4c04f2d37 Mon Sep 17 00:00:00 2001 From: Nick Bolton Date: Mon, 16 Jun 2025 09:13:45 +0100 Subject: [PATCH 2/2] fix: Dismissing room ID causes empty room ID in config --- src/extension.ts | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/src/extension.ts b/src/extension.ts index 1e3d005..8b37174 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -20,6 +20,11 @@ var activeSocket: WebSocket | undefined; var keepAlive: NodeJS.Timeout | undefined; var connected = false; +interface ServerConfig { + baseUrl: string; + roomId: string | null; +} + export function activate(context: vscode.ExtensionContext) { init().catch((error) => { handleError(error); @@ -50,17 +55,20 @@ export function activate(context: vscode.ExtensionContext) { // Register command to show and edit the current room ID context.subscriptions.push( vscode.commands.registerCommand(configureCommand, async () => { - const config = await getServerConfig(); - const roomId = await showRoomIdPrompt(config.roomId); - if (roomId !== config.roomId) { - await updateServerConfig({ ...config, roomId }); - } else { - vscode.window.showInformationMessage(`${extensionName}: Room ID did not change`); - } + await configure(await getServerConfig()); }), ); } +async function configure(config: ServerConfig) { + const roomId = await showRoomIdPrompt(config.roomId); + if (roomId) { + await updateServerConfig({ ...config, roomId }); + } else { + vscode.window.showErrorMessage(`${extensionName}: No room ID provided`); + } +} + export function deactivate() { try { stopConfigWatcher(); @@ -82,8 +90,7 @@ async function init() { console.log(`${logTag} Server config:`, config); if (!config.roomId) { - const roomId = await showRoomIdPrompt(config.roomId); - await updateServerConfig({ ...config, roomId }); + await configure(config); } else { console.log(`${logTag} Using existing room ID: ${config.roomId}`); }