eclipse-langium / langium

Next-gen language engineering / DSL framework
https://langium.org/
MIT License
663 stars 61 forks source link

Opening files with valid multi-language grammar throws errors #1531

Closed Yokozuna59 closed 4 weeks ago

Yokozuna59 commented 4 weeks ago

Langium version: 3.0.0 Package name: langium

Steps To Reproduce

  1. Create a multi-language example
  2. Register languages that has the same file extension
  3. Override ServiceRegistry and create keywords for those languages to switch between them

Link 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:

image

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):

image

This only happens at the start of running the extension; it works fine for that specific file only after the modification:

image

The expected behavior

No errors.

cdietrich commented 4 weeks ago

How did you implement 3