adding macro capability to editor


can I extend an editor for my own language, so it gets macro capability?

If I had this, I could press ctrlshiftm in my own editor to create a macro, just as it is possible in the base language editor.

I have been trying for hours without success. Has anyone done this before and can tell me the steps I have to follow?



Comment actions Permalink


To create an editor with template capabilities you should generate a template editor first. If you look at our baseLanguage you will see in addition to an regular editor jetbrains.mps.baseLanguage.editor a template editor jetbrains.transformation.baseLanguage.editor. This editor is responsible for template editing.

To create template editor you have to:

  • Generate template editor : choose Generate -> Template Editor... A dialog will appear. Choose your language in a list and an output directory for your model and than press ok. A model will be generated
  • Open your language properties. In an editors section add another editor by pression control+enter. Change it stereotype to templates and set a new generated model as an editor model. If you have problems with it you can use jetbrains.mps.baseLanguage as an example
  • Generate code from this model and compile it.
  • Now you can create new template models. To use templates choose templates in model stereotype and than you can use macros and other stuff from templates language

Comment actions Permalink

Thanks, I have learned, that I need to generate code from the editor template model and not just generate the language.

Still I got a problem generating code from the template editor, since the template editor needs a Queries file that is not provided.

Please see the discussion in thread:


Please sign in to leave a comment.