sync accept/reject with edit sidebar
This commit is contained in:
parent
06dd270d7f
commit
ca6770833c
3 changed files with 21 additions and 1 deletions
|
|
@ -281,7 +281,7 @@ export class VsCodeMessenger {
|
|||
await verticalDiffManager.streamEdit(
|
||||
stripImages(prompt),
|
||||
modelTitle,
|
||||
undefined,
|
||||
"edit",
|
||||
undefined,
|
||||
undefined,
|
||||
new vscode.Range(
|
||||
|
|
|
|||
|
|
@ -79,6 +79,7 @@ function Edit() {
|
|||
|
||||
const [showCode, setShowCode] = useState(false);
|
||||
|
||||
// Reusing the applyState logic which was just the fastest way to get this working
|
||||
useEffect(() => {
|
||||
if (editModeState.editStatus === "done") {
|
||||
ideMessenger.request("edit/escape", undefined);
|
||||
|
|
@ -86,6 +87,18 @@ function Edit() {
|
|||
}
|
||||
}, [editModeState.editStatus]);
|
||||
|
||||
const applyState = useSelector(
|
||||
(store: RootState) =>
|
||||
store.uiState.applyStates.find((state) => state.streamId === "edit")
|
||||
?.status ?? "closed",
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (applyState === "closed" && editModeState.editStatus === "accepting") {
|
||||
dispatch(dispatch(setEditDone()));
|
||||
}
|
||||
}, [applyState, editModeState.editStatus]);
|
||||
|
||||
return (
|
||||
<>
|
||||
<TopDiv>
|
||||
|
|
@ -178,6 +191,9 @@ function Edit() {
|
|||
range: editModeState.highlightedCode,
|
||||
});
|
||||
dispatch(submitEdit(prompt));
|
||||
|
||||
// Move cursor to end of editor (it's already focused)
|
||||
editor.commands.selectTextblockEnd();
|
||||
}}
|
||||
></TipTapEditor>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -11,6 +11,10 @@ type UiState = {
|
|||
dialogEntryOn: boolean;
|
||||
nextCodeBlockToApplyIndex: number;
|
||||
onboardingCard: OnboardingCardState;
|
||||
|
||||
/**
|
||||
* Syncs the sidebar with the accepted/rejected blocks in the editor. Reused for Edit as well.
|
||||
*/
|
||||
applyStates: ApplyState[];
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue