Getting an error when using styles in CellModel_RefNodeList

I'm a beginner to MPS and currently trying to use it for a DSL that I'm developing for my current project. After watching the "Constants" screencast I've tried my first steps in MPS and encounter the following issue:

Whenever I try to use Styles in a RefNodeList (I'm trying to layout the child nodes vertically and indented) I get the following error:

textgen error: 'class name is NULL' in [type] ClassifierType <no name>[5139548382504546591] in StreamDSL.editor@7_1 (right-click to see exception)

As a beginner I've a hard time to make sense of that error. So here are my two questions:
1) How to interprete the error message?
2) How to create a vertical and indented child list?

Since I'm a beginner I want to check if I'm using it right before submitting an issue. I'm using build 117.9406 (MPS 2.5 downloaded from the website).

Thanks a lot,
Carsten
3 comments
We encourage everyone to use indent layout instead of vertical/horizontal one where applicable. To create an indented vertical collection you can create wrapping indent collection (looks like [-  -]) with indent-layout-indent: true, selectable : false. (selectable = false means the selection won't stop on this collection while you press Ctrl-Up).

Then, on child collection use indent-layout-new-line-children : true.

Whenever you see (right-click to see exception) it is most probably our fault. At least we didn't provide a better error message from the generator. There are many ways to fix it on your side.
1. Run "Check model" context-menu action on your model. If there are any errors, fix them. Usually this helps.
2. Turn on "Save transient models option" (T icon in the bottom-right corner), browse them in the logical view to review the generation steps. You may compare two transient (aka intermediate) models by selecting them in the tree and choosing "Compare" menu action.
0
Exploring the intermediate models showed me the following method generated in class Stream_Editor (stream is one of my root concepts):

private EditorCell createRefNodeList_rd092_c0(EditorContext editorContext, node<> node) { 
  AbstractCellListHandler handler = new subdomainsListHandler_rd092_c0(node, "subdomains", editorContext); 
  EditorCell_Collection editorCell = handler.createCells(editorContext, new CellLayout_Vertical(), false); 
  { 
    editorCell.setCellId("refNodeList_subdomains"); 
    { 
       style = editorCell.getStyle(); 
      style.set(<no name>.SELECTABLE, false); 
    } 
  } 
  editorCell.setRole(handler.getElementRole()); 
  return editorCell; 
} 
prettyPrint();

The type information for style is missing and that probably also leads to the <no name>.SELECTABLE. Inspecting the interface EditorCell shows that there is also the return type for getStyle() missing:

public interface EditorCell extends Cloneable, EditorCell { 
   
  public static final EditorCell[] EMPTY_ARRAY; 
 
  <...>
  EditorCell_Label getSTHintCell(); 
   getStyle(); 
  boolean isLeaf(); 
  <...>
 
  <<nested classifiers>> 
}
prettyPrint();

While browsing through the Modules Pool of my project I noticed this in Solutions/MPS/Editor/stubs/jetbrains.mps/nodeEditor@java_stub

style-null.jpg


Is there probably something inconsistent / wrong with the packaged models in my installation? Or was something not correctly generated? Do I need to specify a "name" for the styles in my editor?

Thanks,
Carsten
0
It seems like you experience problems with MPS loading..
Can you please try to:
  • uninstall MPS & completely remove MPS installation folder
  • delete <User_Home>/.MPS25/ folder
  • download fresh installation of MPS 2.5.3 and re-install it
  • create new project and try to explore Solutions/MPS/Editor/stubs/jetbrains.mps/nodeEditor@java_stub model. You should have a picture like:
MPSStyles.png
0

Please sign in to leave a comment.