remove focus edit mode without clear command
This commit is contained in:
parent
961e45193f
commit
25e7b951e8
6 changed files with 15 additions and 63 deletions
6
extensions/vscode/package-lock.json
generated
6
extensions/vscode/package-lock.json
generated
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "continue",
|
||||
"version": "1.1.28",
|
||||
"version": "1.1.29",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "continue",
|
||||
"version": "1.1.28",
|
||||
"version": "1.1.29",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@continuedev/fetch": "^1.0.3",
|
||||
|
|
@ -107,7 +107,7 @@
|
|||
"@aws-sdk/credential-providers": "^3.778.0",
|
||||
"@continuedev/config-types": "^1.0.13",
|
||||
"@continuedev/config-yaml": "file:../packages/config-yaml",
|
||||
"@continuedev/fetch": "^1.0.4",
|
||||
"@continuedev/fetch": "^1.0.6",
|
||||
"@continuedev/llm-info": "^1.0.8",
|
||||
"@continuedev/openai-adapters": "^1.0.19",
|
||||
"@modelcontextprotocol/sdk": "^1.5.0",
|
||||
|
|
|
|||
|
|
@ -591,46 +591,6 @@ const getCommandsMap: (
|
|||
);
|
||||
}
|
||||
},
|
||||
"continue.focusEditWithoutClear": async () => {
|
||||
captureCommandTelemetry("focusEditWithoutClear");
|
||||
focusGUI();
|
||||
|
||||
sidebar.webviewProtocol?.request("focusEditWithoutClear", undefined);
|
||||
|
||||
const editor = vscode.window.activeTextEditor;
|
||||
|
||||
if (!editor) {
|
||||
return;
|
||||
}
|
||||
|
||||
const document = editor.document;
|
||||
|
||||
const existingDiff = verticalDiffManager.getHandlerForFile(
|
||||
document.fileName,
|
||||
);
|
||||
|
||||
// If there's a diff currently being applied, then we just toggle focus back to the input
|
||||
if (existingDiff) {
|
||||
sidebar.webviewProtocol?.request("focusContinueInput", undefined);
|
||||
return;
|
||||
}
|
||||
|
||||
const rangeInFileWithContents = getRangeInFileWithContents(false);
|
||||
|
||||
if (rangeInFileWithContents) {
|
||||
sidebar.webviewProtocol?.request(
|
||||
"addCodeToEdit",
|
||||
rangeInFileWithContents,
|
||||
);
|
||||
} else {
|
||||
const contents = document.getText();
|
||||
|
||||
sidebar.webviewProtocol?.request("addCodeToEdit", {
|
||||
filepath: document.uri.toString(),
|
||||
contents,
|
||||
});
|
||||
}
|
||||
},
|
||||
"continue.exitEditMode": async () => {
|
||||
captureCommandTelemetry("exitEditMode");
|
||||
editDecorationManager.clear();
|
||||
|
|
|
|||
2
gui/package-lock.json
generated
2
gui/package-lock.json
generated
|
|
@ -111,7 +111,7 @@
|
|||
"@aws-sdk/credential-providers": "^3.778.0",
|
||||
"@continuedev/config-types": "^1.0.13",
|
||||
"@continuedev/config-yaml": "file:../packages/config-yaml",
|
||||
"@continuedev/fetch": "^1.0.4",
|
||||
"@continuedev/fetch": "^1.0.6",
|
||||
"@continuedev/llm-info": "^1.0.8",
|
||||
"@continuedev/openai-adapters": "^1.0.19",
|
||||
"@modelcontextprotocol/sdk": "^1.5.0",
|
||||
|
|
|
|||
|
|
@ -166,16 +166,6 @@ export function useMainEditorWebviewListeners({
|
|||
[editor],
|
||||
);
|
||||
|
||||
useWebviewListener(
|
||||
"focusEditWithoutClear",
|
||||
async () => {
|
||||
setTimeout(() => {
|
||||
editor?.commands.focus("end");
|
||||
}, 2000);
|
||||
},
|
||||
[editor],
|
||||
);
|
||||
|
||||
useWebviewListener(
|
||||
"isContinueInputFocused",
|
||||
async () => {
|
||||
|
|
|
|||
|
|
@ -1,11 +1,12 @@
|
|||
import { createSlice, PayloadAction } from "@reduxjs/toolkit";
|
||||
import { ApplyState, CodeToEdit, MessageContent } from "core";
|
||||
import { ApplyState, CodeToEdit, MessageContent, MessageModes } from "core";
|
||||
import { EDIT_MODE_STREAM_ID } from "core/edit/constants";
|
||||
export interface EditModeState {
|
||||
codeToEdit: CodeToEdit[];
|
||||
applyState: ApplyState;
|
||||
previousInputs: MessageContent[];
|
||||
enteredEditModeFromEditor: boolean;
|
||||
returnCursorToEditorAfterEdit: boolean;
|
||||
returnToMode: MessageModes;
|
||||
}
|
||||
|
||||
const initialState: EditModeState = {
|
||||
|
|
@ -14,7 +15,8 @@ const initialState: EditModeState = {
|
|||
},
|
||||
previousInputs: [],
|
||||
codeToEdit: [],
|
||||
enteredEditModeFromEditor: false,
|
||||
returnCursorToEditorAfterEdit: false,
|
||||
returnToMode: "chat",
|
||||
};
|
||||
|
||||
export const editModeStateSlice = createSlice({
|
||||
|
|
@ -42,7 +44,7 @@ export const editModeStateSlice = createSlice({
|
|||
codeToEdit: CodeToEdit | CodeToEdit[];
|
||||
}>,
|
||||
) => {
|
||||
state.enteredEditModeFromEditor = payload.fromEditor;
|
||||
state.returnCursorToEditorAfterEdit = payload.fromEditor;
|
||||
const entries = Array.isArray(payload.codeToEdit)
|
||||
? payload.codeToEdit
|
||||
: [payload.codeToEdit];
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { createAsyncThunk } from "@reduxjs/toolkit";
|
||||
import { clearCodeToEdit, setEditDone } from "../slices/editModeState";
|
||||
import { clearCodeToEdit, clearPreviousInputs } from "../slices/editModeState";
|
||||
import { setMainEditorContentTrigger, setMode } from "../slices/sessionSlice";
|
||||
import { ThunkApiType } from "../store";
|
||||
|
||||
|
|
@ -8,8 +8,8 @@ export const exitEditMode = createAsyncThunk<void, undefined, ThunkApiType>(
|
|||
async (_, { dispatch, extra, getState }) => {
|
||||
const state = getState();
|
||||
const codeToEdit = state.editModeState.codeToEdit;
|
||||
const enteredEditModeFromEditor =
|
||||
state.editModeState.enteredEditModeFromEditor;
|
||||
const returnCursorToEditorAfterEdit =
|
||||
state.editModeState.returnCursorToEditorAfterEdit;
|
||||
// const editStreamId = state.editModeState.streamId;
|
||||
|
||||
if (state.session.mode !== "edit") {
|
||||
|
|
@ -23,13 +23,13 @@ export const exitEditMode = createAsyncThunk<void, undefined, ThunkApiType>(
|
|||
}
|
||||
|
||||
dispatch(clearCodeToEdit());
|
||||
dispatch(setEditDone());
|
||||
dispatch(clearPreviousInputs());
|
||||
dispatch(setMainEditorContentTrigger(undefined));
|
||||
|
||||
dispatch(setMode("chat"));
|
||||
|
||||
extra.ideMessenger.post("edit/exit", {
|
||||
shouldFocusEditor: enteredEditModeFromEditor,
|
||||
shouldFocusEditor: returnCursorToEditorAfterEdit,
|
||||
});
|
||||
},
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue