feat: Add autoedit flag for automatic code editing

- Introduce autoedit parameter in diffApply function
- Implement conditional logic for code application method
- Use applyEditCodeWithDiff when autoedit is true
This commit is contained in:
bobo.yang 2024-07-04 21:45:00 +08:00
parent f9f76740c3
commit f9131447c5

View File

@ -1,11 +1,15 @@
import * as vscode from "vscode";
import { applyCodeWithDiff } from "../../handler/diffHandler";
import { applyCodeWithDiff, applyEditCodeWithDiff } from "../../handler/diffHandler";
import { getSymbolDefines } from "../../context/contextRefDefs";
export namespace UnofficialEndpoints {
export async function diffApply(filepath: string, content: string) {
export async function diffApply(filepath: string, content: string, autoedit: boolean = false) {
if (autoedit) {
applyEditCodeWithDiff({ fileName: filepath, content: content }, undefined)
} else {
applyCodeWithDiff({ fileName: filepath, content: content }, undefined);
}
return true;
}