Skip to content

Instantly share code, notes, and snippets.

@adietish
Created November 25, 2024 14:08
Show Gist options
  • Select an option

  • Save adietish/99e79fff044c58c0f56c0000a13a8fd4 to your computer and use it in GitHub Desktop.

Select an option

Save adietish/99e79fff044c58c0f56c0000a13a8fd4 to your computer and use it in GitHub Desktop.
CompletionProvider#provideInlineCompletionItems prompt = '
>>>>>>>>>>>>>>>>
You are a HOLE FILLER. You are provided with a file containing holes, formatted as '{{HOLE_NAME}}'. Your TASK is to complete with a string to replace this hole with, inside a <COMPLETION/> XML tag, including context-aware indentation, if needed. All completions MUST be truthful, accurate, well-written and correct.
## EXAMPLE QUERY:
<QUERY>
function sum_evens(lim) {
var sum = 0;
for (var i = 0; i < lim; ++i) {
{{FILL_HERE}}
}
return sum;
}
</QUERY>
TASK: Fill the {{FILL_HERE}} hole.
## CORRECT COMPLETION
<COMPLETION>if (i % 2 === 0) {
sum += i;
}</COMPLETION>
## EXAMPLE QUERY:
<QUERY>
def sum_list(lst):
total = 0
for x in lst:
{{FILL_HERE}}
return total
print sum_list([1, 2, 3])
</QUERY>
## CORRECT COMPLETION:
<COMPLETION> total += x</COMPLETION>
## EXAMPLE QUERY:
<QUERY>
// data Tree a = Node (Tree a) (Tree a) | Leaf a
// sum :: Tree Int -> Int
// sum (Node lft rgt) = sum lft + sum rgt
// sum (Leaf val) = val
// convert to TypeScript:
{{FILL_HERE}}
</QUERY>
## CORRECT COMPLETION:
<COMPLETION>type Tree<T>
= {$:"Node", lft: Tree<T>, rgt: Tree<T>}
| {$:"Leaf", val: T};
function sum(tree: Tree<number>): number {
switch (tree.$) {
case "Node":
return sum(tree.lft) + sum(tree.rgt);
case "Leaf":
return tree.val;
}
}</COMPLETION>
## EXAMPLE QUERY:
The 5th {{FILL_HERE}} is Jupiter.
## CORRECT COMPLETION:
<COMPLETION>planet from the Sun</COMPLETION>
## EXAMPLE QUERY:
function hypothenuse(a, b) {
return Math.sqrt({{FILL_HERE}}b ** 2);
}
## CORRECT COMPLETION:
<COMPLETION>a ** 2 + </COMPLETION>
<QUERY>
// Related code:
// Path: test.js
// this.result += number;
// return this;
// manual-testing-sandbox/test.js
class Calculator {
constructor() {
this.result = 0;
}
add(number) {
this.result += number;
{{FILL_HERE}}
return this;
}
subtract(number) {
this.result -= number;
return this;
}
multiply(number) {
this.result *= number;
return this;
}
divide(number) {
if (number === 0) {
throw new Error("Cannot divide by zero");
}
this.result /= number;
return this;
}
getResult() {
return this.result;
}
reset() {
this.result = 0;
return this;
}
}
</QUERY>
TASK: Fill the {{FILL_HERE}} hole. Answer only with the CORRECT completion, and NOTHING ELSE. Do it now.
<COMPLETION>'
<<<<<<<<<<<
Ollama#_streamComplete response: 'return'
CompletionStreamer#streamCompletionWithFilters generatorWithCancellation: update of generator = 'return'
Ollama#_streamComplete response: ' this'
CompletionStreamer#streamCompletionWithFilters generatorWithCancellation: update of generator = ' this'
Ollama#_streamComplete response: ''
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
BaseLLM#streamComplete completion = 'return this'
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
stopAtSimilarLine(): STOP, lineIsRepeated: nextLine = 'return this' trimmedLine = 'return this;'
CompletionStreamer#streamCompletionWithFilters fullStop: cancelled! by: Error:
at fullStop (/Users/adietish/git/continue/core/autocomplete/generation/CompletionStreamer.ts:40:91)
at stopAtSimilarLine (/Users/adietish/git/continue/core/autocomplete/filtering/streamTransforms/lineStream.ts:248:7)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at showWhateverWeHaveAtXMs (/Users/adietish/git/continue/core/autocomplete/filtering/streamTransforms/lineStream.ts:545:20)
at update (/Users/adietish/git/continue/core/autocomplete/filtering/streamTransforms/lineStream.ts:176:20)
at StreamTransformPipeline.update [as transform] (/Users/adietish/git/continue/core/autocomplete/filtering/streamTransforms/StreamTransformPipeline.ts:70:22)
at CompletionStreamer.update [as streamCompletionWithFilters] (/Users/adietish/git/continue/core/autocomplete/generation/CompletionStreamer.ts:69:22)
at CompletionProvider.provideInlineCompletionItems (/Users/adietish/git/continue/core/autocomplete/CompletionProvider.ts:229:26)
at ContinueCompletionProvider.provideInlineCompletionItems (/Users/adietish/git/continue/extensions/vscode/src/autocomplete/completionProvider.ts:220:9)
at RH.provideInlineCompletions (file:///Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:137:142456)
postprocessCompletion(): granite = true, completion starts with trimmedPrefix, completion = '' trimmedPrefix = ''
CompletionProvider#provideInlineCompletionItems processedCompletion =
CompletionProvider#provideInlineCompletionItems STOP, completion = undefined! ''
ContinueCompletionProvider#provideInlineCompletionItems: outcome = undefined
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment