diff options
Diffstat (limited to 'extension')
-rw-r--r-- | extension/react-app/src/components/ComboBox.tsx | 7 | ||||
-rw-r--r-- | extension/react-app/src/pages/gui.tsx | 2 | ||||
-rw-r--r-- | extension/src/diffs.ts | 27 |
3 files changed, 26 insertions, 10 deletions
diff --git a/extension/react-app/src/components/ComboBox.tsx b/extension/react-app/src/components/ComboBox.tsx index 31cb4371..7314ed91 100644 --- a/extension/react-app/src/components/ComboBox.tsx +++ b/extension/react-app/src/components/ComboBox.tsx @@ -357,6 +357,8 @@ const ComboBox = React.forwardRef((props: ComboBoxProps, ref) => { dispatch(setShowDialog(true)); }; + const [isComposing, setIsComposing] = useState(false); + return ( <> <div @@ -448,6 +450,8 @@ const ComboBox = React.forwardRef((props: ComboBoxProps, ref) => { disabled={props.disabled} placeholder={`Ask a question, give instructions, type '/' for slash commands, or '@' to add context`} {...getInputProps({ + onCompositionStart: () => setIsComposing(true), + onCompositionEnd: () => setIsComposing(false), onChange: (e) => { const target = e.target as HTMLTextAreaElement; // Update the height of the textarea to match the content, up to a max of 200px. @@ -472,7 +476,8 @@ const ComboBox = React.forwardRef((props: ComboBoxProps, ref) => { setCurrentlyInContextQuery(false); } else if ( event.key === "Enter" && - (!downshiftProps.isOpen || items.length === 0) + (!downshiftProps.isOpen || items.length === 0) && + !isComposing ) { const value = downshiftProps.inputValue; if (value !== "") { diff --git a/extension/react-app/src/pages/gui.tsx b/extension/react-app/src/pages/gui.tsx index 848fcddc..ac7c5070 100644 --- a/extension/react-app/src/pages/gui.tsx +++ b/extension/react-app/src/pages/gui.tsx @@ -247,7 +247,7 @@ function GUI(props: GUIProps) { "mainTextEntryCounter", (currentCount + 1).toString() ); - if (currentCount === 40) { + if (currentCount === 100) { dispatch( setDialogMessage( <div className="text-center"> diff --git a/extension/src/diffs.ts b/extension/src/diffs.ts index e56878c8..98b8753a 100644 --- a/extension/src/diffs.ts +++ b/extension/src/diffs.ts @@ -65,7 +65,20 @@ class DiffManager { return filepath.replace(/\\/g, "_").replace(/\//g, "_"); } + private remoteTmpDir: string = "/tmp/continue"; private getNewFilepath(originalFilepath: string): string { + if (vscode.env.remoteName) { + // If we're in a remote, use the remote's temp directory + // Doing this because there's no easy way to find the home directory, + // and there aren't write permissions to the root directory + // and writing these to local causes separate issues + // because the vscode.diff command will always try to read from remote + vscode.workspace.fs.createDirectory(uriFromFilePath(this.remoteTmpDir)); + return path.join( + this.remoteTmpDir, + this.escapeFilepath(originalFilepath) + ); + } return path.join(DIFF_DIRECTORY, this.escapeFilepath(originalFilepath)); } @@ -76,7 +89,8 @@ class DiffManager { // If the file doesn't yet exist or the basename is a single digit number (vscode terminal), don't open the diff editor try { await vscode.workspace.fs.stat(uriFromFilePath(newFilepath)); - } catch { + } catch (e) { + console.log("File doesn't exist, not opening diff editor", e); return undefined; } if (path.basename(originalFilepath).match(/^\d$/)) { @@ -151,12 +165,12 @@ class DiffManager { // Create or update existing diff const newFilepath = this.getNewFilepath(originalFilepath); - await writeFile(vscode.Uri.file(newFilepath), newContent); + await writeFile(uriFromFilePath(newFilepath), newContent); // Open the diff editor if this is a new diff if (!this.diffs.has(newFilepath)) { // Figure out the first line that is different - const oldContent = await ideProtocolClient.readFile(originalFilepath); + const oldContent = await readFile(originalFilepath); const line = this._findFirstDifferentLine(oldContent, newContent); const diffInfo: DiffInfo = { @@ -192,13 +206,10 @@ class DiffManager { try { vscode.window.showTextDocument(diffInfo.editor.document); vscode.commands.executeCommand("workbench.action.closeActiveEditor"); - } catch { - } finally { - vscode.commands.executeCommand("workbench.action.closeActiveEditor"); - } + } catch {} } this.diffs.delete(diffInfo.newFilepath); - fs.unlinkSync(diffInfo.newFilepath); + vscode.workspace.fs.delete(uriFromFilePath(diffInfo.newFilepath)); } private inferNewFilepath() { |