From 41dc2f02eff97391dbaeb192cf7c874b44e5dd03 Mon Sep 17 00:00:00 2001 From: Nate Date: Tue, 12 Nov 2024 13:43:10 -0800 Subject: [PATCH] fix cmd+L bug --- .../vscode/src/ContinueGUIWebviewViewProvider.ts | 4 ++++ extensions/vscode/src/commands.ts | 16 ++++++++++++++++ gui/src/components/index.ts | 1 - 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/extensions/vscode/src/ContinueGUIWebviewViewProvider.ts b/extensions/vscode/src/ContinueGUIWebviewViewProvider.ts index a7018196c..8c8c399a7 100644 --- a/extensions/vscode/src/ContinueGUIWebviewViewProvider.ts +++ b/extensions/vscode/src/ContinueGUIWebviewViewProvider.ts @@ -15,6 +15,10 @@ export class ContinueGUIWebviewViewProvider public static readonly viewType = "continue.continueGUIView"; public webviewProtocol: VsCodeWebviewProtocol; + public get isReady(): boolean { + return !!this.webview; + } + private updateDebugLogsStatus() { const settings = vscode.workspace.getConfiguration(EXTENSION_NAME); this.enableDebugLogs = settings.get("enableDebugLogs", false); diff --git a/extensions/vscode/src/commands.ts b/extensions/vscode/src/commands.ts index 197a2c111..4733dee6f 100644 --- a/extensions/vscode/src/commands.ts +++ b/extensions/vscode/src/commands.ts @@ -366,6 +366,14 @@ const commandsMap: ( core.invoke("context/indexDocs", { reIndex: true }); }, "continue.focusContinueInput": async () => { + // This is a temporary fix—sidebar.webviewProtocol.request is blocking + // when the GUI hasn't yet been setup and we should instead be + // immediately throwing an error, or returning a Result object + if (!sidebar.isReady) { + focusGUI(); + return; + } + const historyLength = await sidebar.webviewProtocol.request( "getWebviewHistoryLength", undefined, @@ -388,6 +396,14 @@ const commandsMap: ( } }, "continue.focusContinueInputWithoutClear": async () => { + // This is a temporary fix—sidebar.webviewProtocol.request is blocking + // when the GUI hasn't yet been setup and we should instead be + // immediately throwing an error, or returning a Result object + if (!sidebar.isReady) { + focusGUI(); + return; + } + const isContinueInputFocused = await sidebar.webviewProtocol.request( "isContinueInputFocused", undefined, diff --git a/gui/src/components/index.ts b/gui/src/components/index.ts index 7a04bf43a..3a384c995 100644 --- a/gui/src/components/index.ts +++ b/gui/src/components/index.ts @@ -109,7 +109,6 @@ export function parseColorForHex(colorVar: string): string { colorVar, ); if (value.startsWith("#")) { - console.log("OAIJFIOJOOJOIO", colorVar, value, value.slice(0, 7)); return value.slice(0, 7); }