Using the Visual Studio Code Extension
The Visual Studio Code (VSCode) extension enables code hinting (IntelliSense), code snippets, and debugging scripts with breakpoints using VSCode.
Before you begin
- Download Visual Studio Code.
Download and configure the extension
- Install the extension from the Visual Studio Marketplace.
-
Navigate to File > Open
-
Select your Lens Studio project's root folder and click Open
You must open the root folder of each Lens Studio project to enable VSCode debugging. The VSCode extension requires the .vscode
folder containing VSCode debugging configurations.
Use the debugger
With VSCode now configured to work with Lens Studio, you can now enable the built-in debugging solution to debug JavaScript files directly in VSCode.
-
Open your project in Lens Studio.
-
In VSCode, navigate to the Run and Debug tab.
-
Select Attach to running Lens from the dropdown list.
To debug onAwake
events, select Debug Lens instead.
- Click Start Debugging (F5) or press F5 on your keyboard.
VSCode is now attached to Lens Studio. You can set breakpoints to pause Lens execution and step through your code.
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