Logo

Overview

  • Code Overview
  • Features
  • Developer Manuals
  • Technical Requirements
  • Release Notes

User Manual

  • Code Interface
  • File Menu
  • Edit Menu
  • Create Menu
  • Window Menu
  • Help Menu
  • Replicator Menu
  • Microservices Menu
  • Layout Menu
  • Tabs
  • Tool Bar
  • Omniverse Mount Content
  • Grab Handles
  • Selection Modes
  • Preferences Panel
  • Keyboard Shortcuts
  • Optimizing Performance
  • Linux Troubleshooting

RTX Rendering

  • Rendering Basics
  • Render Settings
  • Omniverse RTX Renderer
  • RTX – Accurate (Iray)
  • Lights
  • Cameras
  • Geometry
  • Post-Processing

Included Extensions

  • Extensions Overview
  • Viewport
  • Content Browser
  • Asset Converter
  • Asset Importer
  • Version Control
  • Extensions Manager
  • Console Extension
  • Layers
  • Stage
  • Zero Gravity
  • Property Panel
  • Physics Core
  • Vehicle Dynamics
  • OmniPVD - PhysX Visual Debugger
  • Force Fields
  • Audio
  • Movie Capture
  • Saved Layouts
  • Augmented Reality
  • Tagging Extension
  • Collect Asset
  • USD Paths
  • Browser Extensions
  • Script Editor
  • Layer Linking
  • VS Code Link
    • Enable the required extensions
    • Configure your project for debugging
    • Start the debugger
    • Set a breakpoint
    • Trigger the breakpoint
  • Command History
  • Livestream Client Extensions
  • Profiler
  • QuickSearch
  • Material Graph
  • USD Collections Extension (Preview)
  • OmniGraph
  • Animation
  • Replicator
  • Fluid Dynamics

Learning and Feedback

  • Omniverse Glossary of Terms
  • Nvidia On-Demand Video List
  • Documentation Fix Request
  • General Feedback

Licenses

  • NVIDIA OMNIVERSE LICENSE AGREEMENT
  • SOFTWARE SUPPORT SUPPLEMENT
  • Other Licenses
Omniverse Code
  • »
  • VS Code Link

VS Code Link¶

This tool enables the connection of an Omiverse app to VS Code’s python debugger by using the python ptvsd module. See PTVSD docs and VS Code docs for detailed information on these tools.

Note

The following example assumes you’re familiar with creating an extension and you have VS Code installed. For simplicity, this example will use a new, unmodified Extension Template Project

Enable the required extensions¶

To debug a python extension in VS Code you must first make sure that the Kit Debug VSCode and A Debugger for Python extensions are enabled.

Enter “debug” into the Extensions filter to find them quickly

../_images/ext_vscodelink-enable-extensions.png

In Omniverse Code, the VS Code Link’s window is located next to the Property window. If you don’t see it, make sure the VS Code Link entry is checked in the Window menu. Notice that VS Code Link currently says it’s unattached (in red).

../_images/ext_vscodelink-windowpanel.png

Configure your project for debugging¶

Now open your extension’s project folder in VS Code. An easy way to do this is by having your extension selected in the Extensions window and then by pressing the VS Code icon in the extension information area.

../_images/ext_vscodelink-open-in-vscode-button.png

Verify the configuration settings in launch.json are the same as the Address in the VS Code Link window (127.0.0.1 is the same as localhost). The file should look like this, unless it’s been modified.

../_images/ext_vscodelink-launch-json.png

In the left margin of VS Code, press the Run and Debug button to show the debugger. Make sure “Python Attach” is selected in the debugger configuration drop-down list. This configuration tells the debugger to attach itself to an existing process, since the extension is already running in the Omniverse app.

../_images/ext_vscodelink-select-run-and-debug.png

Start the debugger¶

Now press the Start Debugging arrow, next to the debugger configuration drop-down list, to start debugging

../_images/ext_vscodelink-start-debugging.png

Set a breakpoint¶

Go to your extension’s extension.py and set a breakpoint that’s easy to verify. You set the breakpoint by clicking in the margin left of the line number (red dot in picture below). In this case the Add button’s on_click(), on line 30, is ideal. This will let _count get incremented before the breakpoint is hit so we can verify the results.

../_images/ext_vscodelink-set-breakpoint.png

Trigger the breakpoint¶

Now go back to your Omniverse app. The VS Code Link window should now say it’s attached.

Press the extension’s Add button. When it is pressed the Omniverse app should stop responding. This is because the breakpoint has paused the execution of the extension’s python code.

../_images/ext_vscodelink-press-add.png

Now go back to VS Code to inspect the results. Notice that _count has been incremented to one (from zero) and the debugger is highlighting line 30 (in this case).

../_images/ext_vscodelink-breakpoint-hit.png

Now your extension is linked to the VS Code debugger and you can use the usual python debugger functions.


© Copyright 2019-2023, NVIDIA. Last updated on Mar 21, 2023.

Built with Sphinx using a theme provided by Read the Docs.