Conflict with Statement_comment_Editor

Hey,

in our project, we need an alternative editor for Statement in order to register our own action map and keymap. The problem is that MPS complains about conflicting editors:

Additional editor class jetbrains.mps.baseLanguage.editor.Statement_comment_Editor is applicable to the current context (jetbrains.mps.lang.core.editor.BaseEditorContextHints.comment, myProject.editor.Hints.betterStatementBehavior). Skipping this editor , using class myProject.editor.Statement_betterStatementBehavior_Editor.

Because of this conflict comments are incorrect displayed. Any good idea how to resolve this issue?

Cheers,

Ben

 

11 comments
Comment actions Permalink
Official comment

To summarize, you have two hints applicable to a statement and no editor matches them both. Instead, you have two editors, each matching either of the two hints. The current limitation of MPS is that in situation like this one, it does not have a way to decide, which editor to use. We might address that in the future.

To workaround the limitation, you could define an additional editor applicable to both hints (at the same time), which will have your custom action maps and key maps applied to it a which removes your hint from the context (the remove hints option in the Inspector for the next_applicable_editor cell), thus delegating to the "comment" editor.

Vaclav

 

Comment actions Permalink

This error indicates that you have two editors applicable to the currently selected hints - both "jetbrains.mps.lang.core.editor.BaseEditorContextHints.comment" and "myProject.editor.Hints.betterStatementBehavior" are active and MPS does not know, which editor to show.

It is hard to say what exactly needs to change without seeing the editor definition, I'm afraid.

Vaclav

 

0
Comment actions Permalink

Hi Vaclav,

thanks for the feedback. Here is the editor definition:

 

Or is it somehow possible to override the action map and keymap without providing a new editor? Because this is the only reason I defined one.

Thanks

Ben

0
Comment actions Permalink

This editor definition works fine for me in MPS 3.3.5. Are you on the same version? What does your failing BaseLanguage code look like?

 

0
Comment actions Permalink

Yes on 3.3.5. The code where it fails looks okay:

0
Comment actions Permalink
"To workaround the limitation, you could define an additional editor applicable to both hints (at the same time)"

How can I define an editor that is applicable to both hints? Because, the editor definition allows me to define just exactly one hint.

 

0
Comment actions Permalink

In fact, if you hit Enter in the "hint" area of an editor definition, you'll get a chance to fill in a second hint. An editor definition holds 0..N context hints.

Vaclav

 

0
Comment actions Permalink

Haha :D Thanks!!! I didn't know that one ;) Thanks a lot.

0
Comment actions Permalink

Hm, I don't get it. As soon as I add the comment hint, the specified maps stop working (i.e. won't get called). Am I missing something?

0
Comment actions Permalink

You should now be having two custom editors, one attached to your hind and a second one attached to both hints - your and comment. Both editors should be having the action maps and keymaps set. Is that the case?

0
Comment actions Permalink

No that wasn't the case, but it makes sense now. Thanks a lot!

0

Please sign in to leave a comment.