From d47c4cafb856ffe2efd7d08ceddc8ceda475a8c6 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Thu, 29 Jun 2023 22:46:56 -0700 Subject: lock suggestions until done streaming --- extension/src/debugPanel.ts | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'extension/src/debugPanel.ts') diff --git a/extension/src/debugPanel.ts b/extension/src/debugPanel.ts index 4f3d097c..b176eee7 100644 --- a/extension/src/debugPanel.ts +++ b/extension/src/debugPanel.ts @@ -113,7 +113,13 @@ class WebsocketConnection { if (typeof message !== "string") { message = JSON.stringify(message); } - this._ws.send(message); + if (this._ws.readyState === WebSocket.OPEN) { + this._ws.send(message); + } else { + this._ws.addEventListener("open", () => { + this._ws.send(message); + }); + } } public close() { @@ -231,7 +237,9 @@ export function setupDebugPanel( apiUrl: getContinueServerUrl(), sessionId, vscMediaUrl, - dataSwitchOn: vscode.workspace.getConfiguration("continue").get("dataSwitch") + dataSwitchOn: vscode.workspace + .getConfiguration("continue") + .get("dataSwitch"), }); // // Listen for changes to server URL in settings @@ -249,10 +257,10 @@ export function setupDebugPanel( break; } case "toggleDataSwitch": { - // Set the setting in vscode + // Set the setting in vscode await vscode.workspace - .getConfiguration("continue") - .update("dataSwitch", data.on, vscode.ConfigurationTarget.Global); + .getConfiguration("continue") + .update("dataSwitch", data.on, vscode.ConfigurationTarget.Global); break; } case "websocketForwardingOpen": { -- cgit v1.2.3-70-g09d2