Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>TraceNew to Visual Studio Code? Get it now.
Trace

Trace

Rohan Kandhari

|
548 installs
| (0) | Free
Insert tracing points in Python code and generate dot files
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Trace Extension for VS Code

The Trace Utils Extension helps you seamlessly add tracing points to your Python code and visualize execution flow using DOT graphs. With intuitive features and quick setup, this extension is a powerful tool for debugging and understanding your Python scripts.

Features

  • Insert Trace Points: Add tracing points in your Python code with a single click.
  • Execution Visualization: Generate DOT graphs to visualize the code's execution flow.
  • Preview Graphs: Open and view DOT files with any Graphviz extension.

**For more customized graphs, Check extenstion settings.

Requirements

  • Python 3.x installed and available in PATH
  • VS Code 1.65.0 or higher (preferred 1.96.0)
  • Python's matplotlib module installed Globally
      pip3 install matplotlib
      python3 -m pip show matplotlib #(Verify in a new Terminal)
    

Installation

  1. Install the extension from VS Code Marketplace
  2. Open a Python file
  3. Look for the trace buttons in the editor title bar

Usage

Adding Trace Points

  1. Click the "Insert Trace Points" button in the editor title bar.
  2. It will add a new Trace Terminal.
  3. Enter two line numbers where you want to start and stop tracing, adjust accordingly.
  4. The extension will automatically add the required imports and tracing functions.
  5. Note:
    If tracing points need to be added in different files:
    • Manually add start_tracing() and stop_tracing() at the desired locations in their respective files.
    • In both files, add the following import statement at the top (if not already present):
      from trace_utils import start_tracing, stop_tracing
      

Generating Visualization

  1. Run your Python code with the trace points in Trace Terminal.
  2. A log file will be generated in the current working directory.
  3. Click the "Generate Dot" button in the editor title bar
  4. A output.dot file will be generated in your workspace
  5. Use a Graphviz extension or external viewer to open and view the generated DOT graph.
  6. [Optional] To save it as svg/png
brew install graphviz
dot -Tsvg output.dot -o output.svg
dot -Tpng output.dot -o output.png

usage

graph_with_colors

Extension Settings

This extension contributes the following commands:

  • trace-extension.insertTracePoints: Insert trace points at specified lines
  • trace-extension.generateDot: Generate dot visualization from execution log

Release Notes

1.0.0 - Initial Release of Trace Utils Extension

📧 Contact: rohankandhari63@gmail.com (For any queries, feel free to reach out. All queries will be addressed promptly.)

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft