Skip to content

Debugging in VS Code

Debug your Jac programs with breakpoints, variable inspection, and graph visualization.

Prerequisites

  • Python 3.12+
  • jaclang installed
  • VS Code with Jac extension
  • Time: ~15 minutes

If you’re already familiar with debuggers:

  1. Install Python 3.12+ and jaclang
  2. Install VS Code + Jac extension
  3. Create launch.json (Debug and Run > Create launch.json > Jac Debug)
  4. Open VS Code Command Palette and run jacvis for graph visualization
  5. Set a breakpoint > Run Debugger > Inspect variables

The Jac Debugger helps you find and fix issues in Jac programs. It supports:

  • Breakpoints - Pause execution at specific lines
  • Step-through execution - Execute code line by line
  • Variable inspection - View local and global variable values
  • Graph visualization - Unique to Jac: see your nodes and edges visually

Complete these steps once per computer.

RequirementHow to Check
Python 3.12+python --version
jaclangjac --version
VS CodeDownload
Jac ExtensionExtensions tab > search “Jac”

To set breakpoints in Jac files:

  1. Open VS Code Settings
  2. Search for “breakpoints”
  3. Enable Debug: Allow Breakpoints Everywhere
  1. Open VS Code Extensions panel
  2. Search for “Jac”
  3. Click Install

Do this for each new Jac project.

launch.json tells VS Code how to run the debugger.

  1. Open the Run and Debug panel (Ctrl+Shift+D / Cmd+Shift+D)
  2. Click Create a launch.json file
  3. Select Jac Debug
  4. VS Code generates the configuration automatically

Your .vscode/launch.json will look like:

{
"version": "0.2.0",
"configurations": [
{
"type": "jac",
"request": "launch",
"name": "Jac Debug",
"program": "${file}"
}
]
}

Breakpoints pause execution so you can inspect program state.

Click in the gutter (left of the line number) to set a breakpoint:

def complex_calculation(x: int, y: int) -> int {
result = x * 2; # <- Set breakpoint here
result = result + y;
result = result ** 2;
return result;
}
with entry {
answer = complex_calculation(5, 3);
print(answer);
}
  1. Set your breakpoint
  2. Press F5 or click Run and Debug
  3. The program pauses at the breakpoint
ActionShortcutDescription
ContinueF5Run until next breakpoint
Step OverF10Execute line, skip into functions
Step IntoF11Execute line, enter functions
Step OutShift+F11Run until current function returns
RestartCtrl+Shift+F5Restart from beginning
StopShift+F5Stop debugging

When paused, the Variables panel shows:

  • Local Variables - Variables in the current function scope
  • Global Variables - Variables defined at module level

Jac’s debugger includes a visual tool to see your graph structure in real time.

node Person {
has age: int;
}
with entry {
# Create people nodes
jonah = Person(16);
sally = Person(17);
teacher = Person(42);
jonah_mom = Person(45);
# Connect Jonah to root
root ++> jonah;
# Create Jonah's relationships
jonah ++> jonah_mom;
jonah ++> teacher;
jonah ++> sally;
}
  1. Open the VS Code Command Palette:
    • Windows/Linux: Ctrl+Shift+P
    • macOS: Cmd+Shift+P
  2. Type jacvis
  3. Select jacvis: Visualize Jaclang Graph

A side panel opens showing your graph.

  1. Open the graph visualizer panel
  2. Set a breakpoint in your code
  3. Start debugging (F5)
  4. Step through the code - watch nodes and edges appear in real time

You can drag nodes around to better visualize the structure.


ProblemSolution
Breakpoints are grey / don’t triggerEnable Debug: Allow Breakpoints Everywhere in VS Code settings
”No Jac debugger found”Reload VS Code window after installing Jac extension
Program runs but debugger doesn’t stopUse Run and Debug (F5), not the terminal
Graph doesn’t updateOpen jacvis before starting the debugger