How to extend "Cell Keymap" of default MPS languages

Hey,

I would like to reuse the jetbrains.mps.lang.text in our own DSL but I am missing certain key actions like Ctrl + Backspace (those are available in any normal text editor).

Is there any nice solution to do that?

As far as I can see, there is neither an option to extend a "Cell Keymap" nor too add two keymaps to a single editor cell.

I have three options in mind:

1. Use node attribute

Problem: The node attribute would not be added automatically two each word or am I missing something?

2. Copy the language

Copying a default MPS language is never preferred, of course.

And how is the spell checker implemented?
It looks like the IDE integrated spell checker does not check strings of my own <Word> concept and I can't find any hint how to tell the spell checker to check my concepts as well.

3. Implement an own editor for <Word> with specific context hint

This is actually working (surrounding {value} with two collections, one containing the old keymap and one the new, additional keymap) but I have to set the editor hint which is not perfect.

Thanks for your time and developing this great language workbench!

Best
Sven

0
5 comments

There's another option: create a plugin, define an action to do what you want, bind it to Ctrl+Backspace using a keymap.

 

1

Her Sergej,

thanks for the quick replay.

Adding a plugin is the best workaround, I think.

Unfortunately, "TextElement" is restricted to "Line" and Line always has multiple elements so that is look not possible to have a line of a single element.

May I ask again if there is a way to apply the IDEA spell checker to an own concept?

0

> Unfortunately, "TextElement" is restricted to "Line" and Line always has multiple elements so that is look not possible to have a line of a single element.

I'm not sure what the problem is: Line has elements[1..n] so it's possible to have a line with a single element.

> May I ask again if there is a way to apply the IDEA spell checker to an own concept?

Yes but not a simple one. Here's the class that implements it in MPS, it's hardcoded for Java comments and string literals: https://github.com/JetBrains/MPS/blob/master/plugins/mps-java/platform/modules/jetbrains.mps.java.platform/source_gen/jetbrains/mps/java/platform/highlighters/CommentSpellChecker.java

0

Thanks for link :)

@Line topic:

I would like to have bullet lists and numbered lists. Those should be at the position of a line (so no words can be placed before and after a list).

Extending Line does not work. Replacing line with an own concept does not work (because TextElement must be a child of Line). There might be some more complex solutions to implement the restrictions but I would like to have a simple one.

0

One simple solution that comes to mind could be to create a checking rule for a concept of yours that contains these lists. The rule would check that the lists are well-formatted (no words before/after a list).

0

Please sign in to leave a comment.