A Visual Studio Code extension to analyze Apex class dependencies in a Salesforce org, generate a dependency report in CSV format, and create visual dependency diagrams in DOT, SVG, and PNG formats. The extension stores output files in a temporary directory, opens CSV, DOT, and PNG files in VS Code side editors, and opens the temporary folder in the system file explorer for viewing the SVG in a web browser.
Features
Fetch Apex Classes: Queries all Apex classes in a Salesforce org (excluding managed packages).
Analyze Dependencies: Retrieves dependencies for each Apex class using the Salesforce Tooling API.
Generate Reports:
CSV file (apex_class_dependencies.csv) listing classes and their dependencies.
DOT file (apex_dependencies.dot) for the dependency graph.
SVG file (apex_dependencies.svg) for visual dependency diagrams.
Output Handling:
Stores files in a unique temporary directory (e.g., /tmp/apex-dependency-analyzer-abc123 on Linux/Mac).
Opens CSV, DOT, and PNG files in VS Code side editors.
Opens the temporary folder in the system file explorer (e.g., Finder on macOS, File Explorer on Windows) for viewing the SVG in a web browser.
User Feedback: Displays progress notifications and logs details in the VS Code Output panel ("Apex Dependency Analyzer").
Prerequisites
Visual Studio Code: Version 1.85.0 or higher.
Salesforce CLI: Installed and configured with an authenticated org alias/username.
CSV, DOT files open automatically in VS Code side editors.
The temporary folder opens in the system file explorer (e.g., Finder on macOS, File Explorer on Windows).
Double-click the SVG file in the folder to view it in your default web browser.
Logs: Check the VS Code Output panel ("Apex Dependency Analyzer") for the temporary directory path and detailed logs.
Output Files
Location: Files are stored in a unique temporary directory (e.g., /tmp/apex-dependency-analyzer-abc123 on Linux/Mac, %TEMP%\apex-dependency-analyzer-abc123 on Windows).
Files:
apex_class_dependencies.csv: Comma-separated list of Apex classes and their dependencies.
apex_dependencies.dot: Graphviz DOT file for the dependency graph.
apex_dependencies.svg: Visual diagram viewable in a web browser.
Cleanup: Temporary files persist until the OS cleans them up (e.g., on reboot). Manually delete the temporary directory if needed.