CellModel_Constant extension - how to create it?
Good evening.
I have an idea to create my own CellModel_Constant extension (i.e. concept that extends CellModel_Constant) to override something in behavior, constraint, and editor aspects. The reason for that is: I don't want to override generator aspects, I just want to add some Hooks. But I can't do it because when I use my own concept as a cell I always get a generation issue (something about "out of scope").
I would like to ask: what should I do (in principle) to just create a CellModel_Constant extension with, for example, just a minor change in the original editor? Which steps should I do, which aspect should I define, what kind of settings and where should I change?
Thank you in advance.
Please sign in to leave a comment.
Every case is different, can you post more details of what you're doing and the error you're getting? In principle what you're doing should be okay but there could be some specific detail that breaks and needs a workaround.
Sergej Koščejev, this is a step-by-step "guide" on how to reproduce the issue:
1) Create a new MPS project with 2 Language modules (Lang1 and Lang2)
2) Create a new concept Lang1.TestConcept with an alias "Test"
3) Press CTRL+M to import jetbrains.mps.lang.editor.structure
4) Add "extends CellModel_Constant" to TestConcept
5) Use ALT+ENTER to solve red underlining
6) Do the same as step #5 for a created stub (will be created as a result of solving issues for step #5).
7) Add a constraint for TestConcept for the "text" property to override getter or setter
8) Build Lang1
9) Create a concept Lang2.TestConcept2
10) Add an Editor aspect for TestConcept2
11) Use CTRL+L to import Lang1
12) Add the cell that is defined by the TestConcept from the step #2
13) Build Lang2
Expectation: Everything is ok
Result: issues
Is your Lang1 language marked as extending jetbrains.mps.lang.editor?
You can ignore the red underlines in the generated code, as long as it compiles. MPS checks the generated code with the same rules as the code you write but it's sometimes difficult to ensure that all the references are 100 % correct and it's unnecessary as long as the final text comes out correct.
The broken _cell_factory_method_ reference is a more serious problem, indicating that some code that was supposed to be generated was not. As far as I remember, cell models are generated into editors not only through reduction rules but also via some generator switches that you may need to extend.
Can you push your sample code to GitHub (or any other public source code repository)?