Error on trying to use editorContext in intentions: sharedConcepts is not imported

The execute method of an intention has a parameter `editorContext'. This parameter cannot be used in statements, it will give the error that the language `jetbrains.mps.lang.sharedConcepts ias not imported,. Even when importing this language,  the error remains there.

In other places the `editorComntex' parameter can be used in a normal way. Is this a bug?  Is there a workaround?

I can compile the intentiomn when I turn off the checks, and it will work connectly.  However, I need the code to give no errors on check language.

 

5 comments

I see, the imports vs. used languages battle...

If I'm not mistaken, the red "...sharedConcepts" error has a quick-fix (Alt + Enter) associated, which should import the language for you. This tip may speed things up at times.

1

Hi Jos,

after importing sharedConcepts, pressing F5 is necessary to update the editor. If the error persists, there must be something more specific about your case, which I'm missing, since I cannot reproduce the problem. Can you check the model properties?

Vaclav

 

0

Hi Vaclav, when going through the model properties I found that I added the sharedConcepts to the "dependencies" instead of to the "Used languages". After adding it to Used Languages the error dissappears. 

After all this time, I still getting confused sometimes by the difference between the two.

Tnx, Jos

0

I've been (and still am) sometimes fighting this battle, and I know from my colleagues that it happens to them as well.

My mnemonic at the moment is to distinguish between "instantiating something from a language" (=> reference in "Used langauge" required), and just pointing to some definition (=> reference in "dependencies" required). This might sound trivial and in some cases it does not help immediatly, but most of the time it helps me figuring out what kind of reference I need.

The quickfixes are also helpful, of course, but they also might nourish the issue that MPS users never really think about the difference of "used languages" and "dependencies" until they have to, and then it's a struggle. 

0

Tnx for the rule of thun=mbs,  I'll try to use it next time,  hope it helps me as well.

0

Please sign in to leave a comment.