Code Graph is a code visualization tool for Visual Studio 2012-2017 and allows one to explore the code conveniently.
NOTE: For Visual Studio 2010, please visit https://marketplace.visualstudio.com/items?itemName=YaobinOuyang.CodeGraph2010
NOTE: For Visual Studio 2019, please visit https://marketplace.visualstudio.com/items?itemName=YaobinOuyang.CodeGraph
It uses doxygen to parse code.
Feature List
- Visualize call graph
- Visualize class hierarchy
- Visualize class membership
- Visualize variable usage
- Visualize folder structure
- Visualize file include graph
- Visualize project dependencies
- Quick navigation
- Save/Load graph bookmarks
- Write comments on functions/classes/variables
Supported languages
- C/C++
- C#
- Python (Not tested yet)
- PHP (PHP extension required)
- Other languages that doxygen supports
Tutorial
For beginners, please check out this video:
https://www.youtube.com/watch?v=FIdT3rCPpo0
The video explains all main usages, especially the empty viewport problem reported by many users.
Overview
Here is a screenshot of the plugin.
A diamond is a class.
A disk is a function.
A triangle is a variable.
Colors for these shapes represent different classes, whose name can be seen at the top-left corner.
A "book mark label" is a code position. In the image, it's line 50 in the file "PatternDetector.h".
A white square is a file.
A folder.
Colors for edges represent different graphs, whose name and key short-cut can be seen at the bottom-left corner.
Quick Start
Here are main features for Code Graph.
Mouse
Use mouse wheel
to zoom in and out.
Drag using right mouse button
to move the view.
Navigation
Move cursor onto function/class/variable name in Visual Studio Text Editor, then press Alt+F
to show it on Code Graph.
Press Alt+J/K/L/I
in Visual Studio Text Editor to jump to neighbour items.
Find Callers/Callees/Variable Usage/Include Files
Press Alt+C
to find callers / included files / functions using the variable.
Press Alt+V
to find callees / files including this file / used variables.
Some callees may not be found by pressing Alt+V
. In these cases, place the cursor on those callees and press Alt+H
, then they will be added to Code Graph.
Find Overloaded Functions
Press Alt+O
to find overloaded functions.
Find Class Member
Press Alt+M
to find one class variable and the largest member function. Press Alt+M
several times to see more members.
Find References
Press Alt+U
to find references. Then move to code position and press Alt+U
again to show the actual function.
Save / Load Relationship Graph
Press Ctrl+Num
to add selected edge to a relationship graph.
Press Alt+Num
to show relationship graph listed at the bottom left corner.
Input your comment for functions/classes/variables in Symbol panel.
Add Custom Edge
Some function call relationship can't be detected because of limited capability of doxygen. In this situation, you can create custom edge to represent missing relationship.
You can connect any item using custom edge.
To create custom edge, use middle mouse button
to drag one item to another.
Setup
- Download the vsix package or compile one yourself.
- Open and install the package.
- The package is installed.
- Open Visual Studio, you can see a new menu. Press "Open Code Graph Window" to show the window.
- Open a solution, then press "Analyse solution" to generate the code database for Code Graph.
- A command-line window appears, and you can see "Wait..." on the viewport. You can continue coding during analysis process.
- When analysis is completed, the code database will be opened automatically. Place the cursor on a variable/function/class and press
Alt+F
, then the symbol will appear in the viewport.
- Next time when you open Visual Studio, you don't have to analyse the solution again, just click "Open Analysis Result" and choose a ".graph" file. The file with a "solution" postfix is the analysis result (code database) for the whole solution.
Revision History
1.3.34
1.3.7
- Analyse opened files
- Improve filelist
1.3.6
1.3.1
1.3.0
- Add "sync with editor" mode
1.2.10
- Improve code navigation
- Save layout options
1.2.9
1.2.8
- Fix a bug
- Show all bookmarks
1.2.7
1.2.6
- Improve custom edge creation
1.2.5
1.2.4
- Add custom database folder
- Refine UI
1.2.1
- Show project dependencies
- Add toolbar
1.1.3
- Refine find reference
- Support typedef
- Fix some bugs
1.1.2
- Add custom macro
- Change bookmark color
1.1.1
1.1.0
- Add advanced mode
- Add anchor
- Fix some bugs
1.0.12
1.0.11
- Add buttons for bookmark display
- Fix some bugs
1.0.10
- Layout code position in order
- Save layout results
1.0.9
- Layout in order
- Fix crash bug
1.0.8
- Add force layout
- Adjust UI
1.0.7
- Refine "find reference"
- Add manual layout mode
1.0.6
- Support VS2017
- Add "find reference" and move "find usages" to "find callers" and "find callees"
1.0.5
- Add "contact me" tab
- Add symbol search in viewport
- Adjust appearance
1.0.4
- Improve searching function.
- Some UI improvements.
1.0.3
- Add multiple selection.
- Add file and directory search.
- Add interactive custom edge mode.
- Add custom file extension support.
- Add horizontal/vertical UI layout.
- Fix some bugs.