You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@
8
8
9
9
<divalign="center">
10
10
11
-
**[Continue](https://docs.continue.dev) enables to developers to create, share, and use custom AI code assistants with our open-source [VS Code](https://marketplace.visualstudio.com/items?itemName=Continue.continue) and [JetBrains](https://plugins.jetbrains.com/plugin/22707-continue-extension) extensions and [hub of models, rules, prompts, docs, and other building blocks](https://hub.continue.dev)**
11
+
**[Continue](https://docs.continue.dev) enables developers to create, share, and use custom AI code assistants with our open-source [VS Code](https://marketplace.visualstudio.com/items?itemName=Continue.continue) and [JetBrains](https://plugins.jetbrains.com/plugin/22707-continue-extension) extensions and [hub of models, rules, prompts, docs, and other building blocks](https://hub.continue.dev)**
original: string;// Text with |cur| and |till| markers
3
+
completion: string;// Text to insert/overwrite
4
+
appliedCompletion?: string|null;
5
+
cursorMarker?: string;
6
+
tillMarker?: string;
7
+
}
8
+
9
+
exportinterfaceProcessedTestCase{
10
+
input: {
11
+
lastLineOfCompletionText: string;
12
+
currentText: string;
13
+
cursorPosition: number;
14
+
};
15
+
expectedResult: {
16
+
completionText: string;
17
+
range?: {
18
+
start: number;
19
+
end: number;
20
+
};
21
+
};
22
+
}
23
+
24
+
/**
25
+
* Transforms human-readable test case into input and expected results.
26
+
*
27
+
* - `original`: Your original text with |cur| marking where the cursor is before completion,
28
+
* and |till| marking where the cursor should be after accepting completion (and this is
29
+
* the end of the actual applied completion)
30
+
* - `completion`: LLM completion output
31
+
* - `appliedCompletion` (optional): part of the LLM completion output that is actually applied
32
+
* (written between |cur| and |till| in the original)
33
+
*
34
+
* For example, you have this line:
35
+
*
36
+
* console.log("<cursor here>");
37
+
*
38
+
* and expect it to be completed this way:
39
+
*
40
+
* console.log("foo: ", bar<cursor here>);
41
+
*
42
+
* with your completion coming from LLM being: `'foo: ", bar<cursor here>);'`
43
+
*
44
+
* Your input to this function should be:
45
+
* - original: `'console.log("|cur|"|till|);'`
46
+
* - completion: `'foo: ", bar);'`
47
+
* - appliedCompletion: `'foo: ", bar'`
48
+
*
49
+
* Output: input and expected output of {@link core/autocomplete/util/processSingleLineCompletion/processSingleLineCompletion|processSingleLineCompletion()}
50
+
*
51
+
*/
52
+
exportfunctionprocessTestCase({
53
+
original,
54
+
completion,
55
+
appliedCompletion =null,
56
+
cursorMarker ="|cur|",
57
+
tillMarker ="|till|",
58
+
}: CompletionTestCase): ProcessedTestCase{
59
+
// Validate cursor marker
60
+
if(!original.includes(cursorMarker)){
61
+
thrownewError("Cursor marker not found in original text");
62
+
}
63
+
64
+
constcursorPos=original.indexOf(cursorMarker);
65
+
original=original.replace(cursorMarker,"");
66
+
67
+
lettillPos=original.indexOf(tillMarker);
68
+
if(tillPos<0){
69
+
tillPos=cursorPos;
70
+
}else{
71
+
original=original.replace(tillMarker,"")
72
+
}
73
+
74
+
// Calculate currentText based on what's between cursor and till marker
0 commit comments