Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AST Node has no document #1717

Open
grafandreas opened this issue Oct 15, 2024 · 5 comments
Open

AST Node has no document #1717

grafandreas opened this issue Oct 15, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@grafandreas
Copy link

When working on a new grammar / language, I see the issue that in Linking and other situations, Langium fails with

Error: AST node has no document.
at getDocument (c:\Users\agraf.vscode\extensions\undefined_publisher.XXXXX-0.0.1\out\language\main.cjs:10601:11)

Since in @cdietrich 's report on the formatter he mentions "the" AST node has no document bug, I assume it is already known. Is there further information on that bug?

Regards,

Andreas

@grafandreas grafandreas added the bug Something isn't working label Oct 15, 2024
@msujew
Copy link
Member

msujew commented Oct 15, 2024

Hey @grafandreas,

can you post a reproduction example? I've seen some complaints about it, but failed to reproduce the issue as of now.

@zrwsmd
Copy link

zrwsmd commented Oct 16, 2024

image
i have encounter similar issue by override getDocumentHighlight method in DefaultDocumentHighlightProvider

@msujew
Copy link
Member

msujew commented Oct 23, 2024

@zrwsmd Can you reproduce this consistently? Can you share a reproducible example?

@MarianPalkus
Copy link

Probably this is not the reason but I ran into this error when accidentally using ?= to assign a value to a property of type boolean combined with a rule.

In this example (which might not be very reasonable) :

entry Model:
    persons+=Person*;

Person:
    'person' name=ID isXYZ?=PersonPredicate;

PersonPredicate:
    'knows' other=[Person:ID];

Using this input:

person Foo knows Bar
person Bar knows Foo

The error AST node has no document. occurs (related to the cross references after knows).
This might be just because of an incorrect definition but maybe this can serve as a litte hint.

@spoenemann
Copy link
Contributor

A Boolean assignment with a non-primitive right-hand-side should actually be forbidden. We need a grammar validation check for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants