Opening files with valid multi-language grammar throws errors #1533
Replies: 2 comments 1 reply
-
How did you implement 3 |
Beta Was this translation helpful? Give feedback.
-
I've converted this into a discussion, since this isn't a Langium bug. IIRC your service registry looks at the documents service and attempts to discern what kind of language is within the document. However, during the document loading stage (in the WorkspaceManager), the document to-be-loaded isn't placed in the documents list yet, as it hasn't been created. See this code. You probably need to adjust some of the logic of the document factory here to figure out the service type based on the content of the file without looking into the |
Beta Was this translation helpful? Give feedback.
-
Langium version:
3.0.0
Package name:
langium
Steps To Reproduce
ServiceRegistry
and create keywords for those languages to switch between themLink to code example:
The current behavior
If I opened a file that has a with a valid language grammar (see language id), it throws errors:
But if I delete the content and then add the content again, it works just fine (no need to delete the language keyword, which is here
info
):This only happens at the start of running the extension; it works fine for that specific file only after the modification:
The expected behavior
No errors.
Beta Was this translation helpful? Give feedback.
All reactions