feat: unskip tests

This commit is contained in:
Patrick Erichsen 2025-04-14 10:54:27 -07:00
parent 6852ed1486
commit a5619e29c8
4 changed files with 33 additions and 23 deletions

View file

@ -0,0 +1,6 @@
name: Continue Repo rules
version: 1.0.0
schema: v1
mcpServers:
- uses: continuedev/continue-repo-rules

View file

@ -13,7 +13,7 @@ function canUseInstantApply(filename: string) {
export async function applyCodeBlock(
oldFile: string,
newFile: string,
newLazyFile: string,
filename: string,
llm: ILLM,
): Promise<{
@ -21,11 +21,12 @@ export async function applyCodeBlock(
diffLinesGenerator: AsyncGenerator<DiffLine>;
}> {
if (canUseInstantApply(filename)) {
const diffLines = await deterministicApplyLazyEdit(
const diffLines = await deterministicApplyLazyEdit({
oldFile,
newFile,
newLazyFile,
filename,
);
onlyFullFileRewrite: true,
});
if (diffLines !== undefined) {
return {

View file

@ -21,11 +21,11 @@ async function collectDiffs(
): Promise<{ ourDiffs: DiffLine[]; myersDiffs: any }> {
const ourDiffs: DiffLine[] = [];
for (const diffLine of (await deterministicApplyLazyEdit(
for (const diffLine of (await deterministicApplyLazyEdit({
oldFile,
newFile,
newLazyFile: newFile,
filename,
)) ?? []) {
})) ?? []) {
ourDiffs.push(diffLine);
}
@ -84,7 +84,7 @@ async function expectDiff(file: string) {
}
// Skipped while we have `ONLY_FULL_FILE_REWRITE` enabled
describe.skip("deterministicApplyLazyEdit(", () => {
describe("deterministicApplyLazyEdit(", () => {
test("no changes", async () => {
const file = dedent`
function test() {

View file

@ -15,14 +15,6 @@ type AstReplacements = Array<{
replacementNodes: Parser.SyntaxNode[];
}>;
/**
* Using this as a flag to slowly reintroduce lazy applies.
* With this set, we will only attempt to deterministically apply
* when there are no lazy blocks and then just replace the whole file,
* and otherwise never use instant apply
*/
const ONLY_FULL_FILE_REWRITE = true;
const LAZY_COMMENT_REGEX = /\.{3}\s*(.+?)\s*\.{3}/;
export function isLazyText(text: string): boolean {
return LAZY_COMMENT_REGEX.test(text);
@ -134,11 +126,23 @@ function nodeSurroundedInLazyBlocks(
}
// TODO: If we don't have high confidence, return undefined to fall back to slower methods
export async function deterministicApplyLazyEdit(
oldFile: string,
newLazyFile: string,
filename: string,
): Promise<DiffLine[] | undefined> {
export async function deterministicApplyLazyEdit({
oldFile,
newLazyFile,
filename,
/**
* Using this as a flag to slowly reintroduce lazy applies.
* With this set, we will only attempt to deterministically apply
* when there are no lazy blocks and then just replace the whole file,
* and otherwise never use instant apply
*/
onlyFullFileRewrite = false,
}: {
oldFile: string;
newLazyFile: string;
filename: string;
onlyFullFileRewrite?: boolean;
}): Promise<DiffLine[] | undefined> {
const parser = await getParserForFile(filename);
if (!parser) {
return undefined;
@ -148,8 +152,7 @@ export async function deterministicApplyLazyEdit(
let newTree = parser.parse(newLazyFile);
let reconstructedNewFile: string | undefined = undefined;
// See comments on `ONLY_FULL_FILE_REWRITE` for context
if (ONLY_FULL_FILE_REWRITE) {
if (onlyFullFileRewrite) {
if (!isLazyText(newTree.rootNode.text)) {
return myersDiff(oldFile, newLazyFile);
} else {