diff --git a/package.json b/package.json index 7dd0353..6136b16 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "For Modpack makers.", "repository": "https://github.com/Yesterday17/ZenScript", "license": "MIT", - "version": "0.1.8", + "version": "0.1.9", "publisher": "yesterday17", "engines": { "vscode": "^1.30.0" diff --git a/server/server.ts b/server/server.ts index 8642fbd..b5ec06a 100644 --- a/server/server.ts +++ b/server/server.ts @@ -196,16 +196,19 @@ async function validateTextDocument(textDocument: TextDocument): Promise { const ast: ASTNodeProgram = ZSInterpreter.visit( documentCSTs.get(textDocument.uri) ); - connection.console.log( - JSON.stringify({ - type: ast.type, - import: ast.import, - global: Array.from(ast.global), - static: Array.from(ast.static), - function: Array.from(ast.function), - error: ast.errors, - }) - ); + + if (ast) { + connection.console.log( + JSON.stringify({ + type: ast.type, + import: ast.import, + global: Array.from(ast.global), + static: Array.from(ast.static), + function: Array.from(ast.function), + error: ast.errors, + }) + ); + } // save errors ZSParser.errors.map(error => {