Using VSCode for MonkeyC development

Former Member
Former Member
For those that use VSCode, there is a MonkeyC syntax highlighter which can be found here:
https://marketplace.visualstudio.com...sguth.monkey-c

I also managed to integrate the Build process with a regex to parse out the error messages with hyper links to the line/column. Here is the contents of my tasks.json. Obviously you would need to change the paths a little to match your environment.:
https://pastebin.com/eMsRuEtS

I was also able to make a task for the simulator. I will post more details on that later.
  • Very cool, looking forward to trying it out with a task for the simulator especially. Using Visual Studio Code for editing over Eclipse is a real boon for productivity for me.
  • Wow, big up! Love VSCode, hate Eclipse :)
    This is something that definitely needs more love.
    We've been doing build, run, deploy and .iq package using make with Daniel Siwiec on his project https://github.com/danielsiwiec/garmin-connect-seed
    This could be of help for further development.
  • Former Member
    Former Member over 6 years ago
    For the simulator I simply add this task to my tasks.json:
    https://pastebin.com/3Bn3U9Zu

    Then simulate.bat contains this:
    https://pastebin.com/S8cGXYab

    Again, pathing needs to be changed to match your environment. On a slower machine you may need to increase the sleep to give the sim time to startup before shell.exe tries to connect.

    Also note that the build process isn't included in my simulate task. Sometimes I don't want to do a build before running the sim.
  • Former Member
    Former Member over 5 years ago

    Hello, this is awesome, many thanks. I also hate eclipse so being able to code on VSC is a big plus for me.


    Maybe you can help me with a small problem I'm having while trying to run the compiled program on the simulator. When I use eclipse to run it it runs just fine, but when I try to run the command myself I get the following error:

    ➜ $SDK_HOME/bin/monkeydo bin/garmin-hello-world.prg fenix5_sim
    Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/DatatypeConverter
    at com.garmin.connectiq.common.prgreader.entrypoints.EntryPoint.parse(EntryPoint.java:88)
    at com.garmin.connectiq.common.prgreader.entrypoints.EntryPoints.parse(EntryPoints.java:51)
    at com.garmin.connectiq.common.prgreader.PrgParser.parse(PrgParser.java:221)
    at com.garmin.monkeybrains.monkeydodeux.MonkeyDoDeux.execute(MonkeyDoDeux.java:241)
    at com.garmin.monkeybrains.monkeydodeux.MonkeyDoDeux.main(MonkeyDoDeux.java:145)
    Caused by: java.lang.ClassNotFoundException: javax.xml.bind.DatatypeConverter
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
    ... 5 more

    Do you have any idea? This is one of the few parts that remain to get rid of eclipse...

  • The java that is being found by the monkeydo script (the java in your path) is not supported by our SDK.

    https://forums.garmin.com/developer/connect-iq/f/q-a/167605/monkeyc-command-line-errors/908495#908495

  • This is one of the few parts that remain to get rid of eclipse...

    There's likely a number of things available in Eclipse you've not used yet, like the debugger, App Settings editioe, barrel configuration, project templates, etc.

  • Former Member
    Former Member over 5 years ago in reply to Travis.ConnectIQ

    Thanks. Where is the equivalent jar file so I can just pass it to the correct java runtime?

  • Former Member
    Former Member over 5 years ago in reply to jim_m_58

    Getting rid of eclipse for day to day basic coding. Sure I will keep it open just to use some of the features, but I don't need project templates that much, for example. Most of the things you listed are one use per project or just of sporadic use.

  • Former Member
    Former Member over 5 years ago in reply to Travis.ConnectIQ

    In any case, I was using this previously to run the compilation of monkey-c code

    /Library/Java/JavaVirtualMachines/jdk-12.0.2.jdk/Contents/Home/bin/java \
        -Dfile.encoding=UTF-8 \
        -Dapple.awt.UIElement=true \
        -jar "$SDK_HOME/bin/monkeybrains.jar"

    and that was working.

    Then I just started using just monkeyc binary and it works fine. So unless monkeyc and monkeydo need different java versions there should be something else. If monkeyc works with the java version on my path, why monkeydo does not?

  • Former Member
    Former Member over 5 years ago in reply to Former Member

    Hi Former Member. I found your issue at my GitHub repo. I resolved the problem for Java 10/11 - you can see details in the commit related to that issue. Java 12 will be problematic, as it is not longer shipping the necessary Java EE JARs that previous JDKs shipped and Garmin will need to solve it eventually, perhaps by shipping the necessary JARs with the SDK. In the meantime, the easiest option is using Java <12. Cheers!