Skip to content
Discussion options

You must be logged in to vote

Hi,

generally, you should use the ValidationRegistry for validation checks. See how we use it for langium's own grammar language:

https://github.com/langium/langium/blob/main/packages/langium/src/grammar/langium-grammar-validator.ts

For post processing, @spoenemann previously mentioned a method to do this directly after parsing here. If you need validations to run before that, you can override the validateDocument method of the DocumentValidator in a way like this:

async validateDocument(document: LangiumDocument, cancelToken = CancellationToken.None): Promise<Diagnostic[]> {
    const diagnostics = await super.validateDocument(document, cancelToken);
    this.performPostProcessing(document

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by paulfrench
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants