Skip to main content

Twinit IDE Extension Debug Capabilities

In this lesson you will learn how to give your scripts human readable names, how to test your scripts with input values, and how to find the logs generated when you run a script for debugging.


Runnable Scripts Pattern#

When using scripts you may want to give your scripts human readable names not possible with javaScript function names. Or you may want to clearly call out which scripts should be run and which order they should be run in. This can be accomplished by exposing a function called getRunnableScripts which returns an array of script info objects.

getRunnableScripts() {    return [        { name: "STEP 1: This is a nicer script name", script: "thisIsAScriptFunctionName" },        { name: "STEP 2: Echo Input", script: "echoInput" },        { name: "Step 3: Use Input to Fetch Assets", script: "useInputToFetchAssetItems"}    ]},

When you use the 'Run Script', you'll see select from the names, as opposed to the actual function names.

Running Scripts with Input#

Often your scripts will need to be passed some test input in order to be run. You can use any json object to use as input and then run the 'Run Script with Input' command.

The selected JSON will be passed as the input parameter to your script.

Debug Logs#

The Twinit IDE Extension exposes debug logs, so you can include console.log in your scripts for debugging.

In versions prior to 8.2.0, you can see the logs using the "Toggle Log View" command in the Projects, Scripts & Configs menu. In version 8.2.0 or newer you can see the logs using the "Twinit IDE Console" in the Projects, Scripts & Configs menu.

Hands On#

  1. Download the INT02 - IDE Extension.zip and extract all files
  2. Open the file in Visual Studio Code
  3. Follow the steps in the file