Elements from imported language "out of search scope"

 Hi everyone,

I recently tried to put some helper utilities from a language into a separate language (so as to make them reusable) and then import that language back into the first language. However, no matter what I tried, the issue of the components being "out of search scope" remained.

So far, I've tried:

- Opening both languages in different MPS windows simultaneously (without me doing this, even more errors appear)

- Adding the model root from the utility language:

- Adding the utility language to the dependencies:

- Importing (Ctrl + R) the respective concept into the structure or editor model

- Importing (Ctrl + L) the utility language into the structure or editor model

- Building the utility language as an MPS plugin and then installing it in MPS. This hasn't solved the problem and also made me unable to edit the utility language.

The language elements do show up in auto-completion, but selecting them doesn't resolve the problem:

Any idea how to fix that?

15 comments
Comment actions Permalink

In your case, language1 = mpstools and language2 = Timekeeping

So let's say you've started with a project called myProject which has both mpstools and Timekeeping languages. Now, following Tobias' (may I say very detailed and nice) instructions, you should end up with two projects, say mps-mpstools and mps-timekeeping. Now, your mps-timekeeping project should NOT have the mpstools language, but it should have the mps-mpstools project added to its project libraries, while the mps-mpstools project should only have the mpstools language.

1
Comment actions Permalink

Did you try pressing F5 to rebind some elements? Maybe it's still pointing to old uuids?

0
Comment actions Permalink

I just tried it and it didn't solve the problem.

Also, strangely enough the language will actually build (if I ignore the errors) and the UI elements (editor components) from the utility language will be displayed in the solution editor. However, they won't work properly because they depend on a property added by an interface from the utility language.

0
Comment actions Permalink

Where do you keep your utilities language? I can't see it in your current project. Did you try to add it as a global library or as a project library? You can do this by File --> Settings --> Build, Execution, Deployment --> Project Libraries (or Global Libraries).

You should definitely not add the language as a root. Normally it will work great if you put both languages in the same project. If you don't have them in the same project, then you have to add the project with the utility language as a project library or global library. If you want to distribute the utility language for language developers, you should indeed create an MPS plugin. You can find a simple example for a build solution in https://github.com/DSLFoundry/mps-plaintextgen (see the com.dslfoundry.plaintextgen.build solution).

0
Comment actions Permalink

The utilities language is kept in a separate directory. I just tried what you suggested, removed the model root and added the utility language as a global library (first, I tried to use the path of the language, then I tried the path of the whole project). That made the problem worse - now it's an unresolved reference:

Adding the language.mpl of the utility language to the project paths didn't help either.

0
Comment actions Permalink

Lets say you have a project "projectA" with languages "language1" and "language2", where language2 depends on language1:

(Dependency: Base implements IBase)

 

To separate language1 and language2 you have to do the following:

  1. Remove language2 from project paths in projectA (language2 should disappear in logical view of projectA)
  2. Create a new empty project (projectB):
  3. Move language2 from projectA to projectB in the filesystem (projectA/languages/language2 to projectB/languages/language2)
  4. Open projectB in MPS
  5. Add the moved language (language2.mpl) to project paths in projectB (language2 should appear in logical view of projectB)
  6. To resolve the missing language dependencies you should add "projectA" to your project libraries of projectB:
  7. Now you have successfully seperated two languages. 

EDIT 1: Updated instructions

0
Comment actions Permalink

I've already separated the two languages. I also added the utility language to the project paths and to the project library:

It still can't resolve the reference:

0
Comment actions Permalink

Did you revert all changes that you've made before during your attempts to fix this issue?

 

If you did, i don't know why "mpstools" is still in the "mps-timekeeping" project? I thought this is the language you've separated?

0
Comment actions Permalink

"mpstools" is in the project because I added it to the project path, as you suggested.

0
Comment actions Permalink

Sorry this statement was quite ambiguous...

 

If you move language1 from project A to B you should alter your project paths like this:

1. Remove language1 from the project paths in project A

2. Add language1 to the project paths in project B

0
Comment actions Permalink

I did it a bit differently when I separated the languages (it was before I made this post). I didn't move "timekeeping" into a separate project - I moved "mpstools".

0
Comment actions Permalink

@Eugen Schindler Thanks

I've updated the instructions to be more precise (EDIT 1)

 

0
Comment actions Permalink

@L Gutman94

It doesn't matter if you separate language1 or language2. You just have to change your project libraries according to the language dependencies.

 

E.g.: language2 depends on language1

In my previous example i've separated language2 to projectB and had to add projectA to the project  libraries of the newly created projectB.

If i separate language1 i have to add the newly created projectB to the project libraries of projectA.

 

0
Comment actions Permalink

The problem was that I've already separated the two languages before making this forum post (as I mentioned before) and have done some further work on "mpstools". So I couldn't just start over where Tobias suggested.

Anyway, I resolved the issue by completely removing all references, anywhere, to "mpstools", removing dependencies to it as well, and then adding everything back. What I've noticed is that MPS wanted me to "migrate the project" and "update module descriptors" when I imported "mpstools". I've been clicking on "migrate" every time before, but tried to "postpone" it now and it finally worked. Maybe the migration has been breaking it all along?

0
Comment actions Permalink

I've been trying that as well, but it never worked until I got rid of all usages of and dependencies to "mpstools" in "Timekeeping" and then added them again manually. Anyway, it's resolved now.

0

Please sign in to leave a comment.