fix: 🐛 fix /edit in ssh, pinyin input in combobox

This commit is contained in:
Nate Sesti 2023-08-27 16:52:04 -07:00
parent 1d83a85964
commit cda1be4662
5 changed files with 29 additions and 13 deletions

View file

@ -1,12 +1,12 @@
{
"name": "continue",
"version": "0.0.338",
"version": "0.0.339",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "continue",
"version": "0.0.338",
"version": "0.0.339",
"license": "Apache-2.0",
"dependencies": {
"@electron/rebuild": "^3.2.10",

View file

@ -1,7 +1,7 @@
{
"name": "continue",
"icon": "media/terminal-continue.png",
"version": "0.0.338",
"version": "0.0.339",
"repository": {
"type": "git",
"url": "https://github.com/continuedev/continue"

View file

@ -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 !== "") {

View file

@ -247,7 +247,7 @@ function GUI(props: GUIProps) {
"mainTextEntryCounter",
(currentCount + 1).toString()
);
if (currentCount === 40) {
if (currentCount === 100) {
dispatch(
setDialogMessage(
<div className="text-center">

View file

@ -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() {