Extending editor with reference to instance of an element of a different language

Hi again,

I'm new to extending the MPS language bundles so that's why this question may be very easy to answer:

I want to integrate small snippets of text to help the user of the editor to find the right places to set the cursor to if he/she e.g. wants to create a new element in the AST pressing the return button. These hints should be easy to hide (e.g. using the Editor Context Hint functionality) and easy to change without changing my language. How would you do it?

I thought of an approach like:
  1. Create a new language and there an element for specifying the hint content and make it accessible through its name
  2. Create an additional language element that extends e.g. CellModel_Constant. Include a reference to elements of the type described in 1.
  3. Create a runtime solution, a model and there elements described in 1.
  4. Use the elements described in 2. to refer to the contents when I describe the editor of an element of my actual DSL

But this approach doesn't work, I think, because the reference is somewhere in the nowhere, i.e. it has no parent and thus no model membership. It would be great if you could provide a small description how you solved this issue in your use case.

Thank you in advance for your help and best regards,

Please sign in to leave a comment.