diff --git a/core/autocomplete/constructPrompt.ts b/core/autocomplete/constructPrompt.ts index 9ba4083c3..85bd3c54a 100644 --- a/core/autocomplete/constructPrompt.ts +++ b/core/autocomplete/constructPrompt.ts @@ -80,7 +80,7 @@ async function shouldCompleteMultiline( try { const ast = await getAst(filepath, fullPrefix + fullSuffix); if (!ast) { - throw new Error(`AST undefined for ${filepath}`); + return true; } treePath = await getTreePathAtCursor(ast, fullPrefix.length); diff --git a/core/autocomplete/lineStream.ts b/core/autocomplete/lineStream.ts index 76ea3e01d..c7ecc2f7c 100644 --- a/core/autocomplete/lineStream.ts +++ b/core/autocomplete/lineStream.ts @@ -243,4 +243,8 @@ export async function* stopAtRepeatingLines(lines: LineStream): LineStream { return; } } + + while (repeatedLines.length > 0) { + yield repeatedLines.shift()!; + } }