diff options
author | Nate Sesti <sestinj@gmail.com> | 2023-06-29 22:46:56 -0700 |
---|---|---|
committer | Nate Sesti <sestinj@gmail.com> | 2023-06-29 22:46:56 -0700 |
commit | 1da66af471329204dec9749451d533a47212c7fa (patch) | |
tree | ab6e3da7181fe4b298030b0f110f18823e0558ca /extension/src/debugPanel.ts | |
parent | acb5f920a2d1640b8cc2a3e6f2db1f7d5a554978 (diff) | |
download | sncontinue-1da66af471329204dec9749451d533a47212c7fa.tar.gz sncontinue-1da66af471329204dec9749451d533a47212c7fa.tar.bz2 sncontinue-1da66af471329204dec9749451d533a47212c7fa.zip |
lock suggestions until done streaming
Diffstat (limited to 'extension/src/debugPanel.ts')
-rw-r--r-- | extension/src/debugPanel.ts | 18 |
1 files changed, 13 insertions, 5 deletions
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<boolean>("dataSwitch") + dataSwitchOn: vscode.workspace + .getConfiguration("continue") + .get<boolean>("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": { |