Traversing all nodes of every model
Hello again,
I would like to ask that is there a way to traverse all the nodes of every model that are present in the project?
I know I can access nodes of the modules with jetbrains.mps.lang.smodel by doing:
But I would like to know if I am able to loop through all the models without providing their names explicitly.
Thanks.
I would like to ask that is there a way to traverse all the nodes of every model that are present in the project?
I know I can access nodes of the modules with jetbrains.mps.lang.smodel by doing:
list<node<>> nodes = model/name_of_model/.roots();
But I would like to know if I am able to loop through all the models without providing their names explicitly.
Thanks.
Please sign in to leave a comment.
I don't know where you execute your code but you need a reference to Project. In my example you can access it with an editorContext. Unfortunately this method also contains nodes from stubs, languages and other nodes that you may want to filter. The next approach is maybe a bit better. You can try it in the console:
Hi! FYI, I just want to say thanks to fxlex. His code helped me in my project also!