Skip to content

Commit 087703d

Browse files
author
Calvinn Ng
committed
resolve merge conflicts complete
1 parent 0a8a70d commit 087703d

23 files changed

+565
-1346
lines changed

core/autocomplete/completionProvider.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import OpenAI from "openai";
33
import path from "path";
44
import { v4 as uuidv4 } from "uuid";
55
import { RangeInFileWithContents } from "../commands/util.js";
6-
import { ConfigHandler } from "../config/ConfigHandler.js";
6+
import { IConfigHandler } from "../config/IConfigHandler.js";
77
import { TRIAL_FIM_MODEL } from "../config/onboarding.js";
88
import { streamLines } from "../diff/util.js";
99
import {
@@ -146,7 +146,7 @@ export class CompletionProvider {
146146
private static lastUUID: string | undefined = undefined;
147147

148148
constructor(
149-
private readonly configHandler: ConfigHandler,
149+
private readonly configHandler: IConfigHandler,
150150
private readonly ide: IDE,
151151
private readonly getLlm: () => Promise<ILLM | undefined>,
152152
private readonly _onError: (e: any) => void,

core/config/handler.ts

Lines changed: 0 additions & 116 deletions
This file was deleted.

core/config/load.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,7 @@ async function intermediateToFinalConfig(
368368
}),
369369
)
370370
).filter((x) => x !== undefined) as BaseLLM[];
371+
}
371372

372373
// Command model
373374
let commandModels: BaseLLM[] = [];
@@ -476,7 +477,6 @@ async function intermediateToFinalConfig(
476477
reranker: config.reranker as any,
477478
};
478479
}
479-
}
480480

481481
function finalToBrowserConfig(
482482
final: ContinueConfig,

core/diff/streamDiff.ts

Lines changed: 17 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -13,69 +13,46 @@ export async function* streamDiff(
1313
oldLines: string[],
1414
newLines: LineStream,
1515
): AsyncGenerator<DiffLine> {
16+
const mutatedOldLines = [...oldLines]; // be careful
17+
1618
// If one indentation mistake is made, others are likely. So we are more permissive about matching
1719
let seenIndentationMistake = false;
1820

1921
let newLineResult = await newLines.next();
20-
2122
while (oldLines.length > 0 && !newLineResult.done) {
22-
const { matchIndex, isPerfectMatch, newLine } = matchLine(
23+
const [matchIndex, isPerfectMatch, newLine] = matchLine(
2324
newLineResult.value,
2425
oldLines,
2526
seenIndentationMistake,
2627
);
27-
2828
if (!seenIndentationMistake && newLineResult.value !== newLine) {
2929
seenIndentationMistake = true;
3030
}
3131

32-
let type: DiffLine["type"];
33-
34-
let isLineRemoval = false;
35-
const isNewLine = matchIndex === -1;
36-
37-
if (isNewLine) {
38-
type = "new";
32+
if (matchIndex < 0) {
33+
// Insert new line
34+
yield { type: "new", line: newLine };
3935
} else {
4036
// Insert all deleted lines before match
4137
for (let i = 0; i < matchIndex; i++) {
4238
yield { type: "old", line: oldLines.shift()! };
4339
}
4440

45-
type = isPerfectMatch ? "same" : "old";
46-
}
47-
48-
switch (type) {
49-
case "new":
50-
yield { type, line: newLine };
51-
break;
52-
53-
case "same":
54-
yield { type, line: oldLines.shift()! };
55-
break;
56-
57-
case "old":
58-
yield { type, line: oldLines.shift()! };
59-
60-
if (oldLines[0] !== newLine) {
61-
yield { type: "new", line: newLine };
62-
} else {
63-
isLineRemoval = true;
64-
}
65-
66-
break;
67-
68-
default:
69-
console.error(`Error streaming diff, unrecognized diff type: ${type}`);
41+
if (isPerfectMatch) {
42+
// Same
43+
yield { type: "same", line: oldLines.shift()! };
44+
} else {
45+
// Delete old line and insert the new
46+
yield { type: "old", line: oldLines.shift()! };
47+
yield { type: "new", line: newLine };
48+
}
7049
}
7150

72-
if (!isLineRemoval) {
73-
newLineResult = await newLines.next();
74-
}
51+
newLineResult = await newLines.next();
7552
}
7653

7754
// Once at the edge, only one choice
78-
if (newLineResult.done && oldLines.length > 0) {
55+
if (newLineResult.done === true && oldLines.length > 0) {
7956
for (const oldLine of oldLines) {
8057
yield { type: "old", line: oldLine };
8158
}
@@ -87,4 +64,4 @@ export async function* streamDiff(
8764
yield { type: "new", line: newLine };
8865
}
8966
}
90-
}
67+
}

core/indexing/docs/db.ts

Lines changed: 0 additions & 149 deletions
This file was deleted.

0 commit comments

Comments
 (0)