From e83f8e19289803d29fdfa5fd2e2330e58e17ce4a Mon Sep 17 00:00:00 2001 From: Kyle Li Date: Fri, 18 Oct 2024 20:59:06 -0700 Subject: [PATCH] focus continue session id command --- core/protocol/ideWebview.ts | 1 + extensions/vscode/package-lock.json | 1 + extensions/vscode/package.json | 6 ++++++ extensions/vscode/src/commands.ts | 8 ++++++++ gui/src/components/mainInput/TipTapEditor.tsx | 13 ++++++++++++- 5 files changed, 28 insertions(+), 1 deletion(-) diff --git a/core/protocol/ideWebview.ts b/core/protocol/ideWebview.ts index 3b357b679..bf79315ee 100644 --- a/core/protocol/ideWebview.ts +++ b/core/protocol/ideWebview.ts @@ -66,6 +66,7 @@ export type ToWebviewFromIdeProtocol = ToWebviewFromIdeOrCoreProtocol & { * @deprecated Use navigateTo with a path instead. */ viewHistory: [undefined, void]; + focusContinueSessionId: [{ sessionId: string | undefined }, void]; newSession: [undefined, void]; setTheme: [{ theme: any }, void]; setColors: [{ [key: string]: string }, void]; diff --git a/extensions/vscode/package-lock.json b/extensions/vscode/package-lock.json index f7ab438b3..1abf35ad9 100644 --- a/extensions/vscode/package-lock.json +++ b/extensions/vscode/package-lock.json @@ -116,6 +116,7 @@ "dotenv": "^16.4.5", "fastest-levenshtein": "^1.0.16", "follow-redirects": "^1.15.5", + "google-auth-library": "^9.14.2", "handlebars": "^4.7.8", "http-proxy-agent": "^7.0.1", "https-proxy-agent": "^7.0.3", diff --git a/extensions/vscode/package.json b/extensions/vscode/package.json index 174c5dfdc..3166260c5 100644 --- a/extensions/vscode/package.json +++ b/extensions/vscode/package.json @@ -280,6 +280,12 @@ "category": "Continue", "title": "Docs Force Re-Index", "group": "Continue" + }, + { + "command": "continue.focusContinueSessionId", + "category": "Continue", + "title": "Focus Continue Chat", + "group": "Continue" } ], "keybindings": [ diff --git a/extensions/vscode/src/commands.ts b/extensions/vscode/src/commands.ts index babc695e3..e7373a300 100644 --- a/extensions/vscode/src/commands.ts +++ b/extensions/vscode/src/commands.ts @@ -480,6 +480,14 @@ const commandsMap: ( "continue.viewHistory": () => { sidebar.webviewProtocol?.request("viewHistory", undefined); }, + "continue.focusContinueSessionId": async (sessionId: string | undefined) => { + if (!sessionId) { + sessionId = await vscode.window.showInputBox({ + prompt: "Enter the Session ID" + }); + } + sidebar.webviewProtocol?.request("focusContinueSessionId", { sessionId }); + }, "continue.applyCodeFromChat": () => { sidebar.webviewProtocol.request("applyCodeFromChat", undefined); }, diff --git a/gui/src/components/mainInput/TipTapEditor.tsx b/gui/src/components/mainInput/TipTapEditor.tsx index d98bfef63..3e59f60de 100644 --- a/gui/src/components/mainInput/TipTapEditor.tsx +++ b/gui/src/components/mainInput/TipTapEditor.tsx @@ -151,7 +151,7 @@ function TipTapEditor(props: TipTapEditorProps) { ); const useActiveFile = useSelector(selectUseActiveFile); - const { saveSession } = useHistory(dispatch); + const { saveSession, loadSession } = useHistory(dispatch); const posthog = usePostHog(); const [isEditorFocused, setIsEditorFocused] = useState(false); @@ -807,6 +807,17 @@ function TipTapEditor(props: TipTapEditorProps) { !props.isMainInput, ); + useWebviewListener( + "focusContinueSessionId", + async (data) => { + if (!props.isMainInput) { + return; + } + loadSession(data.sessionId); + }, + [loadSession, props.isMainInput], + ); + const [showDragOverMsg, setShowDragOverMsg] = useState(false); useEffect(() => {