Trace a Python function's full call tree from your cursor and view it as an interactive graph, right inside VS Code.
Features
- Right-click any function in a
.pyfile and run Trace Call Graph from Cursor to recursively walk everything it calls, using Pylance's Call Hierarchy provider. - Renders the trace as an interactive graph (root highlighted, external / library calls greyed out, cycles handled safely).
- Hover a node to see its full signature (parameters and return type).
- Click a node to jump straight to that function's definition in the editor.
- Toggle external (stdlib / site-packages) calls on or off, and fit the graph to the view.
Requirements
- The Pylance extension must be installed and active in your workspace — this extension relies entirely on Pylance's Call Hierarchy provider to resolve calls.
- A Python interpreter/virtual environment selected for the workspace, so Pylance can resolve imports correctly.
Usage
- Open a Python file and place your cursor on a function name.
- Right-click and choose Trace Call Graph from Cursor (or run it from the Command Palette).
- A graph panel opens showing the call tree rooted at that function.
Known limitations
- Traces are capped at 400 nodes to avoid runaway graphs on very large codebases.
- Dynamic dispatch, decorators, and heavy metaprogramming can cause Pylance's call hierarchy to miss some calls — the graph is only as complete as what Pylance itself resolves.
License
MIT