In order to build new features using the language server in our VS Code Extension, an error-tolerant prisma schema parser is needed.
Most of the time, the code in the editor is incomplete and syntactically incorrect, but developers would still expect autocomplete and other language features to work. Therefore, an error tolerant parser is necessary for a Language Server: The parser generates meaningful AST from partially complete code, and the Language Server provides language features based on the AST.
Motivation
In order to build new features using the language server in our VS Code Extension, an error-tolerant prisma schema parser is needed.
Most of the time, the code in the editor is incomplete and syntactically incorrect, but developers would still expect autocomplete and other language features to work. Therefore, an error tolerant parser is necessary for a Language Server: The parser generates meaningful AST from partially complete code, and the Language Server provides language features based on the AST.
Additional context
Related to prisma/prisma#2199 and https://github.com/prisma/vscode/issues/42
How PHP and Go implemented this
https://github.com/Microsoft/tolerant-php-parser https://golang.org/src/go/ast/ast.go