diff --git a/core/autocomplete/ast.ts b/core/autocomplete/ast.ts index 30ac77a99..b87539aa5 100644 --- a/core/autocomplete/ast.ts +++ b/core/autocomplete/ast.ts @@ -12,8 +12,12 @@ export async function getAst( return undefined; } - const ast = parser.parse(fileContents); - return ast; + try { + const ast = parser.parse(fileContents); + return ast; + } catch (e) { + return undefined; + } } export async function getTreePathAtCursor(