Monkey C Visual Studio Code Extension

The Monkey C extension adds support for using the Connect IQ SDK, including a syntax highlighting editor, build integration, and integrated debugger. The Monkey C extension requires Visual Studio Code, version 11 or higher of the Oracle Java™ Runtime Environment, and Connect IQ SDK version 4.0.6 or higher.

This Monkey C extension offers several features, including:

  • Real-Time Errors and Warnings – These will display when editing Monkey C, Jungle, Settings, MSS and Resource XML files. Any reported errors or warnings will display in the Problems tab.

  • Autocompletion – When editing Monkey C, Jungle and MSS files, autocompletion suggestions will be based on the detected scope. In the Monkey C editor, you can autocomplete functions with argument and type information by autocompleting the function keyword in a class or module.

  • References – You can find all references of any class or module member by right-clicking on it and selecting “Find all References” from the context menu. You can also search for a symbol in the document by summoning the command palette and typing @symbol name or search the entire workspace by summoning the command palette and typing #symbol name.

  • Hovering – See type information about a variable, function name, class or module by hovering the mouse over the symbol in question.

  • Go to Definition – You can jump to the definition of any class or module member by selecting “Go to Definition” from the context menu.

  • Folding Ranges – Comments, imports and regions of code can now be folded.

To fully take advantage of these features, your project needs to have a type check level of gradual or higher. Real time errors will be for the last device the project was built for, or the first product in the manifest if no product has been built during your current session.

Installing the Monkey C Extension

  1. In Visual Studio Code go to the View > Extension

  2. In the Extensions Marketplace search box type "Monkey C"

  3. Select the Monkey C extension from Garmin

  4. Use the Install button to install the extension in Visual Studio Code. This will require a restart of Visual Studio Code.

  5. After Visual Studio Code restarts, summon the command palette with Ctrl + Shift + P (Command + Shift + P on Mac)

  6. Type "Verify Installation" and select Monkey C: Verify Installation

Project Management

The following commands can be used to create a new project and export it:

CommandDescription
Monkey C: New ProjectCreate a new Connect IQ app or Monkey Barrel
Monkey C: Build Current ProjectCompiles the current project against a specified device
Monkey C: Build for DeviceExport wizard to generate a side loaded PRG for a device
Monkey C: Clean ProjectDeletes any cached artifacts generated by the build system
Monkey C: Export ProjectCreates an IQ or barrel file for the project

Manifest Editing

The following commands can be used to edit and update the manifest.xml of your project:

CommandDescription
Monkey C: Edit ProductsEdits the products in the manifest.xml. Only allows selecting products that support the minimum SDK version
Monkey C: Edit PermissionsEdits the permissions in the manifest.xml
Monkey C: Edit LanguagesEdits the languages in the manifest.xml
Monkey C: Edit ApplicationEdits the application metadata (name, label, identifier) in the manifest.xml
Monkey C: Configure BarrelWizard to add or remove Monkey Barrels from your project
Monkey C: Set Products by Connect IQ VersionAllows mass selection of all products that meet a Connect IQ version
Monkey C: Edit AnnotationsAllows adding new annotations to Monkey Barrel projects
Monkey C: Regenerate UUIDCreates a new application UUID for your project

Interfacing with the Connect IQ SDK

The following commands allow you to access the SDK tools and documentation from Visual Studio Code:

CommandDescription
Monkey C: Open ERA ViewerOpens the Error Reporting Application tool
Monkey C: Open Monkey GraphOpens the Monkey Graph tool
Monkey C: Open Monkey MotionOpens the Monkey Motion tool
Monkey C: Open SDK ManagerOpens the Connect IQ SDK Manager
Monkey C: View DocumentationProvides access to all of the Connect IQ SDK documentation

Running the Program

Before running the program, make sure you have one of your source files (In the source folder with the .mc extension) open and selected in the editor.

  1. Select Run > Run Without Debugging (Command + F5 on Mac, Ctrl + F5 on other platforms)

  2. You will be prompted with the list of products your application supports. Select one from the list.

If all goes well, the simulator will start up and the selected watch will appear:


Running Run No Evil Tests

You can use the following command to run tests:

CommandDescription
Monkey C: Run TestsRuns all the Run No Evil tests in your application

Running Complication Publisher and Complication Subscriber Apps

You can use the following command to run and debug both the complication publisher and the complication subscriber apps:

CommandDescription
Monkey C: Launch ComplicationRuns the complication apps in debugger

You can also run the complication apps with or without debugging via the launch.json by adding the "Run Complication Apps" launch configuration to it.

Running App in Sensor Pairing Mode

You can use the following command to launch and debug the app in sensor pairing mode:

CommandDescription
Monkey C: Launch Native PairingRuns the app in sensor native pairing mode in debugger

You can also run the app in sensor pairing mode with or without debugging via the launch.json by adding the "Run Native Pairing" launch configuration to it.

Editing the Launch Configuration

The extension will create a launch.json for your project when you run or debug your product. The launch.json provides many customization options for adding launch functionality

PropertyRequiredTypeDescription
prgxPathAbsolute path to project prg file
prgDebugXmlxPathAbsolute path to project debug xml file
stopAtLaunch BooleanWhen debugging, break immediately when the program launches.
runTests BooleanRun runNoEvil test cases when running this configuration
device Product IdentifierDevice to run or ${command:GetTargetDevice} to choose a new device each run
settingsJson PathAbsolute path to project settings file
tests Array of StringsAn optional array of strings listing the test names to run
runNativePairing BooleanRun app in sensor native pairing mode
complicationPublisherFolder PathAbsolute path to the project folder of a complication publisher
complicationSubscriberFolder PathAbsolute path to the project folder of a complication subscriber