Skip to content

Adds TypeScript/JavaScript Function Usage Graphs#32

Open
ccpu wants to merge 4 commits into
DucPhamNgoc08:mainfrom
ccpu:main
Open

Adds TypeScript/JavaScript Function Usage Graphs#32
ccpu wants to merge 4 commits into
DucPhamNgoc08:mainfrom
ccpu:main

Conversation

@ccpu

@ccpu ccpu commented Jul 1, 2026

Copy link
Copy Markdown

Adds TypeScript/JavaScript Function Usage Graphs that build a reverse caller graph for the function under the cursor. The graph supports source navigation and drill-in code-flow popups for caller functions, with linked panel reuse so split usage/flow workflows stay in the expected editor group. Also updates command metadata to use clean context-menu labels while preserving CodeVisualizer command-palette grouping, and documents the new feature and current language support.

image

ccpu added 4 commits July 1, 2026 11:27
- Introduced a new command `codevisualizer.visualizeFunctionUsage` to visualize the usage of functions in TypeScript and JavaScript.
- Implemented `FunctionUsageProvider` to handle the display of the usage graph in a webview.
- Created `CallGraphAnalyzer` to analyze function definitions and their callers within the workspace.
- Added `CallGraphMermaidGenerator` to render the usage graph in Mermaid format.
- Enhanced `TsAstParser` to extract function call information for building the call graph.
- Updated `package.json` to include new scripts and dependencies for local installation and testing.
- Improved the overall structure and organization of the codebase to support the new functionality.
* Keep usage graphs and flowcharts in separate panels so callers can be explored without losing context.
* Clean up command labels and menus to surface the new navigation flow more clearly.
* keeps the diagram readable after moving or resizing the panel, because svg-pan-zoom only measures the viewport once
* bumps the extension version for the release carrying this fix
@DucPhamNgoc08

Copy link
Copy Markdown
Owner

I like the direction, but I would not merge this yet.

The main issue is that the usage graph resolves calls by function name only. Names like save, init, render, and load are reused a lot. This can merge unrelated functions into the same graph and make node clicks jump to the wrong definition. The existing flowchart feature is tied to a specific file and function range, so this new graph should be at least that precise.

There is also a mismatch between the analyzer and the command. The analyzer indexes forms like const fn = function () {} and class field arrows, but the command uses findFunctionAtPosition(), which does not recognize all of those forms. So some functions can be indexed but cannot be used as the starting point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants