fix: comment out auto apply on MFE

This commit is contained in:
Test 2025-01-09 16:43:30 -08:00
parent addbdcb9f5
commit f61476a493
5 changed files with 35 additions and 26 deletions

View file

@ -172,7 +172,7 @@ export async function deterministicApplyLazyEdit(
oldText.slice(endIndex);
} else {
console.warn("No matching node found for lazy block");
return [];
return undefined;
}
}
}

View file

@ -359,7 +359,7 @@ export class VerticalDiffHandler implements vscode.Disposable {
// Clear deletion buffer
await this.insertDeletionBuffer();
this.reapplyWithMeyersDiff(diffLines);
await this.reapplyWithMeyersDiff(diffLines);
this.options.onStatusUpdate(
"done",
@ -386,6 +386,7 @@ export class VerticalDiffHandler implements vscode.Disposable {
startLine: number,
numGreen: number,
numRed: number,
skipStatusUpdate?: boolean,
) {
if (numGreen > 0) {
// Delete the editor decoration
@ -415,15 +416,18 @@ export class VerticalDiffHandler implements vscode.Disposable {
// Shift the codelens objects
this.shiftCodeLensObjects(startLine, offset);
const numDiffs =
this.editorToVerticalDiffCodeLens.get(this.fileUri)?.length ?? 0;
if (!skipStatusUpdate) {
const numDiffs =
this.editorToVerticalDiffCodeLens.get(this.fileUri)?.length ?? 0;
const status = numDiffs === 0 ? "closed" : undefined;
this.options.onStatusUpdate(
status,
numDiffs,
this.editor.document.getText(),
);
const status = numDiffs === 0 ? "closed" : undefined;
this.options.onStatusUpdate(
status,
numDiffs,
this.editor.document.getText(),
);
}
}
private shiftCodeLensObjects(startLine: number, offset: number) {
@ -482,11 +486,15 @@ export class VerticalDiffHandler implements vscode.Disposable {
* we have received all of the diff lines.
*/
async reapplyWithMeyersDiff(diffLines: DiffLine[]) {
// First, we reset the original diff by deleting any new lines and clearing decorations
for (const range of this.greenDecorationManager.getRanges()) {
await this.deleteLinesAt(
range.start.line,
range.end.line - range.start.line + 1,
// First, we reset the original diff by rejecting all pending diff blocks
for (const block of this.editorToVerticalDiffCodeLens.get(this.fileUri) ??
[]) {
await this.acceptRejectBlock(
false,
block.start,
block.numGreen,
block.numRed,
true,
);
}

View file

@ -98,7 +98,7 @@ export default function CodeToEditListItem({
</div>
</div>
<div className="invisible flex items-center gap-1.5 group-hover:visible">
<div className="invisible flex items-center group-hover:visible">
<div className={`flex items-center ${isInsertion ? "hidden" : ""}`}>
{showCodeSnippet ? (
<ChevronDownIcon

View file

@ -24,7 +24,7 @@ export default function ApplyActions(props: ApplyActionsProps) {
setShowApplied(true);
const timer = setTimeout(() => {
setShowApplied(false);
}, 2_000);
}, 5_000);
return () => clearTimeout(timer);
}
}, [isClosed, isSuccessful]);

View file

@ -131,18 +131,19 @@ export default function StepContainerPreToolbar(
}
}, [props.children, codeBlockContent]);
useEffect(() => {
const hasCompletedGenerating =
wasGeneratingRef.current && !isGeneratingCodeBlock;
// Temporarily disabling auto apply for Edit mode
// useEffect(() => {
// const hasCompletedGenerating =
// wasGeneratingRef.current && !isGeneratingCodeBlock;
const shouldAutoApply = hasCompletedGenerating && isInEditMode;
// const shouldAutoApply = hasCompletedGenerating && isInEditMode;
if (shouldAutoApply) {
onClickApply();
}
// if (shouldAutoApply) {
// onClickApply();
// }
wasGeneratingRef.current = isGeneratingCodeBlock;
}, [isGeneratingCodeBlock]);
// wasGeneratingRef.current = isGeneratingCodeBlock;
// }, [isGeneratingCodeBlock]);
async function onClickAcceptApply() {
const fileUri = await inferResolvedUriFromRelativePath(