Skip to content

Commit 03066e4

Browse files
committed
Ignore exceptions from parser
1 parent 4053dca commit 03066e4

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

server/src/project/workspace.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,14 @@ export class Workspace {
4848
this.activateDocument(document);
4949
this._parseCancellationTokenSource?.cancel();
5050
this._parseCancellationTokenSource = new CancellationTokenSource();
51-
await this._activeDocument?.parseAsync(this._parseCancellationTokenSource.token);
51+
52+
// Exceptions thrown by the parser should be ignored.
53+
try {
54+
await this._activeDocument?.parseAsync(this._parseCancellationTokenSource.token);
55+
} catch (error) {
56+
this.connection.console.log(`Parser error: ${error}`)
57+
}
58+
5259
this._parseCancellationTokenSource = undefined;
5360
this.connection.sendDiagnostics(this._activeDocument?.languageServerDiagnostics() ?? {uri: "", diagnostics: []});
5461
}

0 commit comments

Comments
 (0)