VSCode - multi folder setup

I have following folder structure:

  • shared
    • res-core
    • res-font
    • res-icons
    • res-strings
    • src-core
    • src-devices
    • src-font
    • ...
  • watchfaces
    • WF1
    • WF2
    • ...

As you can see, I have shared res and src folders outside of my watchface projects - in eclipse this was no problem, I could show all folders at once inside a project and still run the project.

In VSCode I can open the folder .../watchfaces/WF1 and then I can start the project without problems. But if I open the root folder ../ then I see all my source folders as desired but I can't run a watchface. If I right click on WF1 I would expect something like "run this project" but there is no such entry and if I click the menu on top and click start debugging it does not work because VSCode does not know which project to start on so it tries to start the root folder which does not contain anything to run...

Question

Can I somehow open a folder with multiple projects in VSCode and then start a sub project?

  • I found following solution:

    Dirty solution

    I could open a parent folder and simply open the monkey.jungle file - if this one is clicked and opened it sometimes is seen as the current project. But the longer I used that solution the more often it did not work...

    Clean solution

    VSCode does support workspaces - this can be used for the above mentioned use case. Open the main project (the watchface), then add other folders to the current workspace (File>Add Folder to workspace) and then save the workspace. This seems to work quite well now.

  • actually it can be easier and just have a structure like this in your workspace.

    WF1

    WF2

    res-core

    res-font

    res-icons

    res-strings

    src-core

    src-devices

    src-fonts

    (you actually only need WF1 and WF2 in the workspace)

    for the monkey,jungle in WF1 and WF2 have something like

    base.sourcePath=source;..\scr-core;..\src-devices;..\src-fonts

    base.resourcePath=resources;..\res-core;..\res-font;..\res-icons;..\res-strings

    Then in VS Code, have a launch.json for WF1 and another one for WF2, and do a "Run App WF1" for example.

    You could keep your current structure and adjust the relative paths in the jungle file

    I use a bunch of common code in projects and this is how I do it unless I'm using barrels.

  • Does this launch json also work for running / building / exporting? Or can it be made for such tasks as well?

  • It's how you do the runs.  You use the command pallete for exporting, etc.

    After you select what you are running, you use the run menu to select with or without debugging:

  • thanks. that helps with the run configuration but how do you build and export the correct project in this setup? Building current project e.g. mostly fails with "Connect IQ project not found" error. Clicking the monkey.jungle file helps sometimes but not always...

  • Open an mc file in the project you want to export, open the command palette, then "Monkey C: Export Project" (for example)

  • thanks, I'll try that whole setup again