Console: looking for sample queries for finding errors, run checks, ...

Recently I was struggling with java stubs and Tikhomirov Artem was kind enough to learn me how to fix one of them using the console (https://mps-support.jetbrains.com/hc/en-us/community/posts/360007678340-importing-jars-ASMClassType-out-of-search-scope- 

Now that I got the hang of using the console, I would like to get more out of it. But it seems there is little documentation. I understand that most of it is just another way to use BaseLanguage, smodel queries etc and I am confortable with that (up to a point), that is not the issue. The issue is more like: what is the node (or pattern of nodes) that I ought to be looking for? For example

- I know how to traverse all models in a solution, but how to invoke "check model" on each of them?

- I know how to traverse all BaseLanguage nodes in a java stub, but how to query a node for for any associated errors? I was expecting to find such errors as annotations to the node -- but not so. Using the node explorer did not help. So my question really is: where are the errors that show as red wiggly underlines in the editor expressed in the java stub / BaseLanguage model?

I would appreciate to have some examples here.

4 comments
Comment actions Permalink

Hi Jennek,

ModelCheckerTool.getInstance(#project as MPSProject.getProject()).checkModulesAndShowResult(#modules<scope = editable>.toList)

 

0
Comment actions Permalink

Thank you, Kemal. That is definitely something I would not have found myself. ModelCheckerTool is a good starting point for further exploration. 

I tried limiting the scope to one module like this,

but it seems this is not the preferred form. Any suggestions?

0
Comment actions Permalink

I also tried running the checks on a java stub solution. I found out this only works if you enable this explicitly: go to Settings|Preferences > Tools > Model Checker > Check stub models.

0
Comment actions Permalink

Hi Jennek, the settings is either globally configured in the MPS, or (I guess) project settings.
You can of course use one of the methods allowing to pass the ModelCheckerSettings you wish for the special invocation.

There is another call, that checks models...

ModelCheckerTool.getInstance(#project as MPSProject.getProject()).checkModelsAndShowResult(#models<scope = editable>.select({~it => it/; }).toList, null)

0

Please sign in to leave a comment.