🐛 don't try to calculate AST in non-code files

This commit is contained in:
Nate Sesti 2024-03-02 21:28:23 -05:00
parent c9f53d7c76
commit 8187e0d39a
2 changed files with 5 additions and 1 deletions

View file

@ -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);

View file

@ -243,4 +243,8 @@ export async function* stopAtRepeatingLines(lines: LineStream): LineStream {
return;
}
}
while (repeatedLines.length > 0) {
yield repeatedLines.shift()!;
}
}