programmatically add used language (or dependency) to existing model
Hi,
I'm generating models programmatically and filling the up with content also programmatically. However I am having trouble adding used languages programmatically (I do not know the languages used by the model in advance). I have tried using the Open API and this code I found linked to the used guide:
// adding used language to a module
AbstractModule internalModule = (AbstractModule) sModule;
internalModule.getModuleDescriptor().getUsedLanguages().add(
module reference
/jetbrains.mps.baseLanguage/);
However this does not work. I'm using MPS 3.4.1 and there actually the getUsedLanguages method is deprecated.
Thank you!
Levi.
Please sign in to leave a comment.
Used languages on module level are automatically updated. You have to add them to the models only.
Thanks, Sascha, adding the language to the model worked fine! For reference, here is the code I used:
Where outputLanguage is of type SLanguage
Cheers,
Levi.
Hi,
Am a newbie to MPS. My usecase is almost similar to the above mentioned
So anyone let me know how to retrieve the "Slanguage" ?
Regards
Deepak P
Hi Deepak,
Sorry, I didn't understand your question. Do you mean you want to add SLanguage to a model programatically?
Best,
Levi.
Hi,
Yes, I need to add programmatically a language dependency as shown in the attachment.
Deepak P
You can just type "language/.../". The concept of this expression is jetbrains.mps.lang.smodel.LanguageRefExpression.
Thanks a lot ... :) it worked ...