From f1c0fe7c8eb7abef4688e8133e73e96c4a669f45 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Sun, 25 Feb 2024 13:04:49 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix=20focus=20shortcut?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/llm/countTokens.ts | 2 +- extensions/vscode/media/welcome.md | 14 ++++++---- gui/src/components/mainInput/TipTapEditor.tsx | 20 +++++++------ gui/src/pages/history.tsx | 28 ++++++++----------- 4 files changed, 31 insertions(+), 33 deletions(-) diff --git a/core/llm/countTokens.ts b/core/llm/countTokens.ts index fddbee08a..292efd09e 100644 --- a/core/llm/countTokens.ts +++ b/core/llm/countTokens.ts @@ -1,5 +1,5 @@ import { Tiktoken, encodingForModel as _encodingForModel } from "js-tiktoken"; -// @ts-expect-error +// @ts-ignore import llamaTokenizer from "llama-tokenizer-js"; import { ChatMessage, MessageContent, MessagePart } from ".."; import { autodetectTemplateType } from "./autodetect"; diff --git a/extensions/vscode/media/welcome.md b/extensions/vscode/media/welcome.md index e7b3b6e52..a82406b1f 100644 --- a/extensions/vscode/media/welcome.md +++ b/extensions/vscode/media/welcome.md @@ -1,13 +1,9 @@ # 👋 Welcome to Continue -## ❗️ Before you get started - -Continue is currently in the left sidebar, but we recommend moving it to the right. This way it won't cover your file explorer. You can move it back at any time. - -![Move Continue to right sidebar](./sidebar.gif) - ## 🔑 Most important shortcuts +> If you've been using Continue, these have changed + Cmd/Ctrl + L = Select code Cmd/Ctrl + Shift + L = Select code for follow-up @@ -16,6 +12,12 @@ Continue is currently in the left sidebar, but we recommend moving it to the rig Cmd/Ctrl + Shift + R = Automatically debug terminal +## ❗️ Before you get started + +Continue is currently in the left sidebar, but we recommend moving it to the right. This way it won't cover your file explorer. You can move it back at any time. + +![Move Continue to right sidebar](./sidebar.gif) + ## ⚡️ Setting up tab autocomplete 1. Download [Ollama](https://ollama.ai) diff --git a/gui/src/components/mainInput/TipTapEditor.tsx b/gui/src/components/mainInput/TipTapEditor.tsx index ba3c21c86..de1be0e86 100644 --- a/gui/src/components/mainInput/TipTapEditor.tsx +++ b/gui/src/components/mainInput/TipTapEditor.tsx @@ -353,7 +353,7 @@ function TipTapEditor(props: TipTapEditorProps) { const handleKeyDown = (event: any) => { if ( isMetaEquivalentKeyPressed(event) && - (isJetBrains() ? event.code === "KeyJ" : event.code === "KeyM") + (isJetBrains() ? event.code === "KeyJ" : event.code === "KeyL") ) { setIgnoreHighlightedCode(true); setTimeout(() => { @@ -393,7 +393,9 @@ function TipTapEditor(props: TipTapEditorProps) { if (historyLength > 0) { saveSession(); } - editor?.commands.focus("end"); + setTimeout(() => { + editor?.commands.focus("end"); + }, 20); }, [historyLength, saveSession, editor, props.isMainInput] ); @@ -404,7 +406,9 @@ function TipTapEditor(props: TipTapEditorProps) { if (!props.isMainInput) { return; } - editor?.commands.focus("end"); + setTimeout(() => { + editor?.commands.focus("end"); + }, 20); }, [editor, props.isMainInput] ); @@ -416,7 +420,9 @@ function TipTapEditor(props: TipTapEditorProps) { return; } saveSession(); - editor?.commands.focus("end"); + setTimeout(() => { + editor?.commands.focus("end"); + }, 20); }, [editor, props.isMainInput] ); @@ -476,11 +482,7 @@ function TipTapEditor(props: TipTapEditorProps) { ); useEffect(() => { - if (!props.isMainInput) { - return; - } - - if (editor && !document.hasFocus()) { + if (props.isMainInput && editor && document.hasFocus()) { editor.commands.focus(); // setTimeout(() => { // // https://github.com/continuedev/continue/pull/881 diff --git a/gui/src/pages/history.tsx b/gui/src/pages/history.tsx index b276f1ce9..6110818ef 100644 --- a/gui/src/pages/history.tsx +++ b/gui/src/pages/history.tsx @@ -113,7 +113,9 @@ function TableRow({ navigate("/"); }} > -
{session.title}
+
+ {JSON.stringify(session.title).slice(1, -1)} +
{date.toLocaleString("en-US", { year: "2-digit", @@ -271,28 +273,20 @@ function History() { )} */}
- {sessions.filter((session) => { - if ( - !filteringByWorkspace || - typeof workspacePaths === "undefined" || - typeof session.workspaceDirectory === "undefined" - ) { - return true; - } - return workspacePaths.includes(session.workspaceDirectory); - }).length === 0 && ( -
- No past sessions found. To start a new session, either click the "+" - button or use the keyboard shortcut: Option + Command + N -
- )} -
setSearchTerm(e.target.value)} /> + + {filteredAndSortedSessions.length === 0 && ( +
+ No past sessions found. To start a new session, either click the "+" + button or use the keyboard shortcut: Option + Command + N +
+ )} + {filteredAndSortedSessions.map((session, index) => {