Stack Code
A VS Code extension for tracking function call flows across files while exploring unknown codebases. You manually "push" code selections onto named stacks to build a visual map of execution paths.
How it works
- Stacks are named lists where you push selected code snippets in the order they'd execute.
- Each pushed item records the file, line number, and original line content.
- If the file is later edited and the line changes, the reference is marked as invalid (line changed) — the item stays in the stack but the navigation link is removed.
- Click any valid reference in the panel to jump straight to that file and line.
Development
Prerequisites
- Node.js >= 18
- VS Code >= 1.74
Setup
cd /home/jfb01/stack-code
npm install
npm run compile # one-off build
# or
npm run watch # watch mode (rebuilds on save)
Run in development (Extension Development Host)
- Open the
stack-code folder in VS Code:
code /home/jfb01/stack-code
- Press F5 (or Run → Start Debugging).
This opens a second VS Code window — the Extension Development Host — with the extension loaded.
- In the EDH window, open any project and use the extension.
Rebuild after changes
If running in watch mode (npm run watch), just reload the EDH window:
Ctrl+Shift+P → Developer: Reload Window.
Install (VSIX)
1. Package the extension
cd /home/jfb01/stack-code
npm install -g @vscode/vsce # install the packaging tool once
npm run compile
vsce package # produces stack-code-0.0.1.vsix
2. Install the VSIX in VS Code
Option A — from the terminal:
code --install-extension /home/jfb01/stack-code/stack-code-0.0.1.vsix
Option B — from VS Code UI:
Extensions sidebar → ··· menu → Install from VSIX… → select the file.
Reload VS Code when prompted.
Uninstall
Option A — from the terminal:
code --uninstall-extension stack-code.stack-code
Option B — from VS Code UI:
Extensions sidebar → find Stack Code → gear icon → Uninstall.
Usage
Commands
| Command |
Default keybinding |
Description |
Stack Code: Create New Stack |
— |
Creates a new named stack |
Stack Code: Push Selection to Stack |
Ctrl+Shift+K / Cmd+Shift+K |
Pushes selected text to a stack |
The Push command is also available in the editor right-click context menu when text is selected.
The + icon in the Stacks panel header also triggers Create New Stack.
Workflow example
- Open the Stack Code panel in the Activity Bar (layers icon on the left).
- Click + or run Create New Stack → give it a name (e.g.
login flow).
- In any file, select a function call or expression, then press
Ctrl+Shift+K.
- Pick the stack from the dropdown.
- The item appears in the panel with a
file:line link. Click it to jump back.
- Repeat for the next step in the call chain — items are shown in push order with arrows between them.
- Remove individual items with the ✕ on each item, or remove the whole stack with the ✕ on the stack header.
Data persistence
Stacks are stored in VS Code's workspace state (workspaceState), so they persist between sessions for the same workspace but are not shared across workspaces.