~/yunemregul/blog/callgraph-plugin
githublinkedin
·1 min read·featuredcallgraphintellijpluginjavaproductivity

Visualizing Method Calls in IntelliJ IDEA

CallGraph is an IntelliJ plugin I built so I could stop tracing method relationships in my head. Place your cursor on any method and get an interactive graph of its callers.

I work on large Java codebases, and Find Usages in IntelliJ IDEA answers "who calls this method?" one level at a time. To see the full chain I had to click through each caller and keep the path in my head.

I built CallGraph, a plugin that draws the whole chain as one graph.

What it does

CallGraph works on Java, Kotlin, and mixed projects. I put the caret on a method, hit generate, and get a graph of its callers, their callers, and so on.

  • visualize: interactive graph of method call relationships
  • navigate: click any node or edge to jump straight to the source
  • explore: pan and zoom through larger graphs
  • export: save the graph as a standalone HTML file

How to use it

  1. Right-click on a method and choose Generate Call Graph.
  2. Or open the CallGraph tool window (View → Tool Windows → CallGraph), place your caret on a method, and hit GENERATE.
  3. Or use the keyboard shortcut Alt+Shift+E (Option+Shift+E on macOS).
  4. Click nodes to jump to their definitions, click edges to see exactly where the call happens. Pan and zoom through larger graphs. Save as HTML to keep it.

How it works

The backend is Java. It starts from the method under the caret and runs IntelliJ's ReferencesSearchon it, then repeats that for every caller it finds. It uses the IDE's own index, so it sees the same references Find Usages does.

A popular utility method can have thousands of callers, so the search has limits. The defaults are 8 levels deep, 10 callers per node, and 150 nodes in total, with test code filtered out. All of them can be changed in the settings, and so can the direction: callers, callees, or both.

The frontend is JavaScript. vis-network renders the graph inside the JCEF browser that ships with the IDE. The two sides talk over JBCefJSQuery: the graph goes to the browser as JSON, and clicks come back to Java to open the file at the right line.

JetBrains Marketplace
CallGraph

Visualize caller–callee relationships for any Java or Kotlin method. Jump straight to definitions or call sites.

3,406 installsFreeGPL-3.0plugins.jetbrains.com ↗
yunusemregul/callgraph

IntelliJ IDEA plugin that creates a callers graph for selected methods. Issues and PRs welcome.

Java14GPL-3.0github.com ↗