Skip to main content

Visual Studio Code Extension

The Lens Studio Visual Studio Code Extension enables code hinting, code snippets, and debugging scripts with breakpoints in Lens Studio products using VSCode.

  • Available on all platforms
Platform details: Snapchat, SPECS, Camera Kit Web, Camera Kit Mobile fully supported.

Platform details

  • Snapchat — Fully supported.

  • SPECS — Fully supported.

  • Camera Kit Web — Fully supported.

  • Camera Kit Mobile — Fully supported.

The Visual Studio Code (VSCode) extension enables code hinting (IntelliSense) and code snippet.

By default, Lens Studio will add a TypeScript definition file d.ts in the saved Lens Studio project's Support folder. You can get type ahead by opening a saved project folder on an editor that supports it (for example, VSCode) without this extension.

To set breakpoints and step through your scripts, see the External Debugger guide.

Before you begin

  1. Download Visual Studio Code.

Download and configure the extension

  1. Install the extension from the Visual Studio Marketplace.
  1. Navigate to File > Open

  2. Select your Lens Studio project's root folder and click Open

Use code snippets

Use code snippets by typing ls_ and previewing the list of options. Skip the ls_ prefix if you already know which snippet you need.

Press Enter to select the snippet.

Input snippets

  • ls_input_X (for every valid type)

ls_input_X also declares the variable using the /*@type/ annotation

  • ls_input_color_rgb
  • ls_input_color_rgba
  • ls_input_combobox

Event snippets

  • ls_create_event
  • ls_create_stored_event
  • ls_create_delayed_event

Type name snippets

  • ls_asset_name
  • ls_component_name
  • ls_event_name

UI widget snippets

  • ls_ui_widget
  • ls_ui_label
  • ls_ui_group
  • ls_ui_group_start
  • ls_ui_group_end

Functional snippets

  • ls_get_sceneobject_local
  • ls_get_transform_local
  • ls_get_component_local
  • ls_get_components_local
  • ls_create_component_local
  • ls_lerp_function
  • ls_inv_lerp_function
  • ls_remap_function
  • ls_get_component_recursive_function
  • ls_get_components_recursive_function
  • ls_random_range_function
  • ls_behavior_add_trigger_response
  • ls_behavior_send_trigger
  • ls_behavior_safe_add_trigger_response
  • ls_behavior_safe_send_trigger