-
I wonder if there is already a way to implement the "importURI" mechanism from XText? I would like to create a DSL which is able to import other files. Example: persons.dsl:
main.dsl:
is there already something included in langium to enable this? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 7 replies
-
Hi @goto40 By default, every element is exported from a file and available for referencing in the global scope. You should be able to restrict this (to only scope to elements which are imported) by overriding the default scope provider. Alternatively, you can keep it loose and validate that only references are valid to files which are declared as being imported. That's how we currently do grammar importing for the langium grammar language. I'm sure @spoenemann has more to say about that ;) |
Beta Was this translation helpful? Give feedback.
-
I agree with the approach of validating imports. The advantage: not imported elements stay in scope and so completion and go-to-definition work for them. |
Beta Was this translation helpful? Give feedback.
Hi @goto40
By default, every element is exported from a file and available for referencing in the global scope. You should be able to restrict this (to only scope to elements which are imported) by overriding the default scope provider. Alternatively, you can keep it loose and validate that only references are valid to files which are declared as being imported. That's how we currently do grammar importing for the langium grammar language.
I'm sure @spoenemann has more to say about that ;)