Java Graph is a VS Code extension that scans .java source files in your workspace and renders interactive, theme-aware UML class diagrams — with zero dependency on Maven, Gradle, or any build tool.
Screenshots
Overview & Package Clustering
Focus Mode & Relationship Highlighting
Features
Full Java Type Support: Extracts class, interface, enum, record, and @interface declarations along with field visibilities (+, -, #, ~).
Smart Relationship Detection: Resolves project-local extends, implements, field association (including multi-type generics like Map<K, V> and wildcard imports import pkg.*;), and optional constructor/method dependency (uses) edges.
Readable Dense Diagrams:
Edge Aggregation: Merges parallel associations between the same two types into a single labeled edge.
Package Clustering: Groups classes visually by package.
Interactive Filters: Toggle Associations, Dependencies, Hide isolated, Packages, or filter by a specific package.
Focus Mode & Search:
Click any card to highlight it in orange and its connected relationships in blue while dimming unrelated nodes.
Use Find type... with keyboard navigation (↑ / ↓ / Enter) to jump directly to any type.
Source Navigation & Auto-Refresh:
Double-click (or Ctrl/Cmd + click) a card to open its .java file at the type declaration.
Reuses open diagram panels and refreshes automatically when .java files are saved.
VS Code Theme Integration: Adapts seamlessly to your active light, dark, or high-contrast theme using VS Code's syntax and UI tokens.
Export: Copy as Mermaid (classDiagram) or save as standalone SVG.
Usage
File Diagram: Right-click a .java file in the editor or Explorer and select Java Graph: Show File Diagram to inspect its types and direct relationships.
Folder Diagram: Right-click a folder in the Explorer and select Java Graph: Show Project Diagram to scope the diagram to that folder.
Workspace Diagram: Run Java Graph: Show Project Diagram from the Command Palette (Ctrl+Shift+P / Cmd+Shift+P).
Controls
Click a card: Focus / highlight neighbors (Esc or click empty canvas to clear)
Double-click (or Ctrl/Cmd + click) a card: Open source file at declaration
Mouse wheel: Zoom around cursor
Left-drag: Pan (Alt + drag or Alt + wheel for horizontal pan)
Fit / Re-layout: Fit diagram to viewport or cycle layout orientation (BT, LR, TB, RL)
Notes: External library types are not resolved. Generated output folders (target, build, out, bin, node_modules) are excluded automatically.
Development
bun run compile — Type-check with TypeScript (tsc --noEmit)
bun test — Run unit tests
bun run build — Bundle the extension into dist/extension.js with esbuild