What is the preferred way to add a "builtin" model #391
-
I would like to provide a built-in model. For example I am allowed to define types in my model (e.g. I would like to provide a bullt-in model defining
with a builtin model defined as follows:
What is the preferred way to do this in langium?
Maybe you already have an example in your unittests I did not see... |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 4 replies
-
In Langium 0.2 you can create a subclass of |
Beta Was this translation helpful? Give feedback.
-
In Langium 0.3, in the WorkspaceManager: I wonder what is intended to be passed as URI to LangiumDocumentFactory.fromString when using an in-memory model (which has no corresponding file). Using a non-existing filename seems to work, but yields logs on the console in some situations: The following happens when I move the cursor over a reference to the model built in memory (I used the URI
|
Beta Was this translation helpful? Give feedback.
-
I further tried to unit-test my built-in model. For that I first made a test w/o the buit-in model, which works as expected (I adapted my "load model" from
However, when adapting the test to use my built-in model (I added
Probably I just made some mistake on calling the API - I surely did not understand the details of how the |
Beta Was this translation helpful? Give feedback.
-
Note: in case of multiple languages it is important to use a valid URI (else the extension is not extracted correctly; langium 0.4.0). Thus, use |
Beta Was this translation helpful? Give feedback.
In Langium 0.2 you can create a subclass of
IndexManager
and overrideinitializeWorkspace
to add an additional library document. In Langium 0.3 this functionality is moved to a new serviceWorkspaceManager
(#377).