HOW-TO · DEV

How to configure AI debugging breakpoints using VS Code AI-assisted debugging extension

intermediate15 minBy Fredoline Eruo
Target environment
Ubuntu 24.04 · Ollama 0.4.x
PREREQUISITES

VS Code installed, AI debugging extension (GitHub Copilot Chat or Cursor AI Debugger), a debuggable project in the workspace

What this does

AI-assisted debugging extensions in VS Code can automatically place breakpoints at locations likely to harbor bugs based on code analysis. Rather than setting breakpoints manually across an entire codebase, the AI inspects the source and proposes a targeted set of breakpoints. A developer then attaches the debugger, and execution halts precisely where the AI identified potential failure points, reducing the time spent stepping through irrelevant code paths.

Steps

  1. Open the project in VS Code and ensure the debugger for the project's language is installed. For Node.js, install the CodeLLDB or use the built-in JavaScript debugger. For Python, install the Python extension with Pylance or pyright.

  2. Open the AI chat panel in VS Code (Ctrl+Shift+I or the sidebar icon depending on the extension).

  3. Type a query such as "Suggest breakpoints for this function" or "Place AI breakpoints to debug the auth flow" in the chat input. Include the file name or function name if known.

  4. The AI extension analyzes the source code and returns a list of proposed breakpoint locations with line numbers and reasoning for each.

  5. In the AI response, click Apply breakpoints or the equivalent action button to insert conditional or unconditional breakpoints at the suggested lines. Alternatively, manually click the gutter next to the reported line numbers.

  6. Open the Breakpoints panel in VS Code (Ctrl+Shift+F5 or Debug → Breakpoints) to view and manage the placed breakpoints. Enable or disable individual breakpoints by toggling the checkboxes.

  7. Configure conditional breakpoints if desired. Right-click a breakpoint and set a condition such as count > 0 or userId === null to halt only when the specific state is reached.

  8. Start the debugging session by selecting the appropriate launch configuration from the Run and Debug panel (F5).

  9. When execution halts at a breakpoint, use the AI chat again to ask "Why did execution stop here?" or "What are the current variable values?" to get contextual analysis.

  10. Remove or adjust breakpoints that prove uninformative and repeat the AI suggestion process for deeper stack frames.

Verification

Start a debugging session with the AI-placed breakpoints active. Confirm that execution halts at one of the suggested breakpoint locations rather than running freely to completion. The Debug Console in VS Code should display the paused state with call stack information.

Common failures

  • No debugger available for the language: AI breakpoint suggestions require a working debugger in the workspace. If the language extension is not installed or the debugger binary is not on the PATH, the debug session fails immediately. Verify the extension is installed and the debugger is reachable with which node or equivalent.
  • Breakpoints show as unverified (hollow circles): This occurs when the source file does not match what the debugger expects, typically due to sourcemaps being misconfigured or the build output being out of date. Run a fresh build before attaching the debugger.
  • AI suggests breakpoints in library code rather than application code: Most AI debugging extensions default to analyzing the entire workspace. Restrict the analysis scope by specifying the exact file or module in the chat query, for example "Suggest breakpoints in src/auth/service.ts only."
  • Conditional breakpoint never triggers: The condition expression must be valid JavaScript, Python, or the target language syntax. Syntax errors in the condition silently disable the breakpoint. Test the condition in the debug console first to confirm it evaluates correctly.
  • Extension does not have debug permissions: AI debugging extensions require the debug scope in VS Code user settings. Check that the extension has permission to launch and attach to processes under Manage Extension → Settings → Runtime permissions.

Related guides