Visual Studio Code

Visual Studio Code (known commonly as VSCode) is a free code editor developed by Microsoft. As such it has extensive documentation about its general use, which we will not repeat here. Instead this page will focus on the ways to get the most out of VSCode when developing code for Student Robotics.

Python Extension

While VSCode has some built-in support for developing Python, we recommend that you additionally install the official Python extension. This brings more comprehensive support and enables everything else we will document here.

Code Completions

In order for VSCode to pick up the sr.robot3 library and offer completions you’ll need to make the library available within the Python environment that you’re using.

  1. Open the workspace containing your code.
  2. Open a terminal via TerminalNew Terminal.
  3. Run pip install sr.robot3.

Remote Debugging

When connected to the robot’s WiFi hotspot, it is possible to attach VS Code’s debugger to the robot by performing the following steps:

  1. Ensure the Python extension is installed.
  2. Open the Run and Debug panel.
  3. Click the cog icon at the top of the panel.
  4. Paste the following configuration:
     "version": "0.2.0",
     "configurations": [
             "name": "Attach to Robot",
             "type": "python",
             "request": "attach",
             "connect": {
                 "host": "robot.lan",
                 "port": 5678
             "pathMappings": [
                     "localRoot": "${workspaceFolder}",
                     "remoteRoot": "."
             "justMyCode": true
  5. Add the following snippet to the top of your code:
    import debugpy
    debugpy.listen(("", 5678))

If you would like for your code to not run until the debugger is attached, you can also add the following:

print("Waiting for debugger...")
  1. In order to debug, you can now either click the green play button at the top of the Run and Debug panel or press F5.

For more information on debugging with Visual Studio Code, please visit the VS Code documentation