Diagram
See how the files in a change depend on each other.
A file list tells you what changed; it does not tell you how the pieces fit together. The diagram draws every changed file as a box, grouped into blocks the way its language groups code, and connects the files that depend on each other — so you can see where a change starts and what it reaches before you read a line.
What it looks like

- Each box is a changed file, inside a block for its package or project (see Blocks). Boxes list the file's members, with the changed ones marked.
- Each file ends with its counts, as its row in the file list does — the lines added (
+), changed (~) and removed (−), what moved here, and how many changes are spotlighted and muted. Diagram settings › Show change statistics turns them off and on for every diagram and flow, as does Settings › Diagram › Change statistics. - Click a file to open its diff in its tab. ⌘-click (Ctrl-click on Windows and Linux) opens it in a modal over the diagram instead — read it, mark it viewed, comment, step through its changes — and Esc brings you back to the diagram as you left it. Diagram settings or Settings › Diagram › Opening files swap the two, for every diagram and flow. Right-click a member for Show Flow — who calls it and what it calls (Call flow).
- Scroll or drag the canvas to move around, and ⌘-scroll to zoom. Drag a block to rearrange the layout; its lines follow it.
Blocks
A block is the unit the file's language cuts code into, found from the repository's own project files:
| Language | A block is |
|---|---|
| Go | A package — one folder — named by its path from its module's go.mod (pkg/fanal/types). Its testdata/ belongs to it. |
| Java, Kotlin, Scala, Groovy | A package under a source root (src/main/java/…), named as Java names it (org.acme.orders); tests are … (test) |
| Python | A package — one folder — named by its import path (app.routes) |
| C#, F#, Visual Basic | A project: the nearest folder holding a .csproj, .fsproj or .vbproj, named after it |
| TypeScript, JavaScript | A package: the nearest folder holding a package.json; a big one is split by its well-known folders (components, hooks) |
| Rust, C, C++, Ruby, PHP, Swift, Dart, Lua, GDScript | A folder of code, named by its path from its project (Cargo.toml, composer.json, …) when it has one |
A file that is no code joins the package of its folder, or the project around it (an appsettings.json is its .NET project's); documentation outside any is grouped by its first folder. When a folder cannot be read, the diagram falls back to what the path alone says.
Structure rules
When the blocks are not how your team thinks of the code, say so with structure rules: each folder a rule names becomes one block with everything beneath it, whatever its language would make of it. The deepest folder any rule names wins, so a rule can carve a folder out of another rule's block.
Right-click a file, a folder or a block's header → Extract to separate block… opens a small window: a folder filled in for you, the folders above it to pick from, an optional name, which of your files to save the rule to, how many files of this review it takes — and every rule there already is. The diagram regroups as soon as the rule is saved. Edit, reorder, switch off or delete rules in Settings › Diagram › Structure rules.
Rules live in three files, the first one that names a folder winning:
| File | Whose | Edited |
|---|---|---|
.mantish/structure.local.json | Yours, for this repository | In the app; kept out of git (.mantish/.gitignore) |
.mantish/structure.json | The team's, committed | In a commit — the app shows it read-only, Copy |
~/.mantish/structure.json | Yours, for every repository | In the app |
{
"version": 1,
"rules": [
{ "paths": ["pkg/*/"] },
{ "paths": ["src/Infrastructure.*/"], "name": "Infrastructure" }
]
}
A path names folders in the same glob dialect as every .mantish file — * within a folder name, ** across folders. Without a name, each folder a rule names is a block named after it (pkg/*/ makes crypto, fanal, …); with one, every folder it names is one block of that name. Copy as file on your own files gives the team's file to commit. The terminal draws the same blocks.
Connections
The Connections legend lists six kinds of dependency. Untick one to hide those lines:
| Connection | Meaning |
|---|---|
| uses | One file uses a type declared in the other — a parameter's, a field's or a constructed type — or a value of it: a field, a property, a constant |
| imports | One file imports the other |
| implements | A type declares that it implements an interface from the other file — implements, a base list, a module mixed in |
| extends | A type declares that it extends a type from the other file — a base class, an interface's parent, an embedded struct |
| tests | One file is a test for the other, by name — the nearest one when several share it; in Go, its own directory's — and whatever the test names of it |
| calls | One file calls a function, a method or a constructor declared in the other |
A line is drawn where Go to Declaration would take you: the diagram and the navigation read the same rules of each language, so a name that jumps to another file of the pull request is a connection to that file, and a name declared outside the pull request draws nothing. Where the rules can only guess what a name means — a value whose type the pull request does not show — no line is drawn rather than one that may be wrong. A type several files add to (an extension, a reopened class) is drawn to the file that declares it; the files that extend it are reached through the members they add. A type or a global the language itself provides — Ruby's String, Lua's require — stays the language's even where a file of the pull request reopens or replaces it, and test code is never what production code depends on: a spec's mock of a global draws no line from the code it tests.
To see only what the change touches, turn on Hide connections of unchanged code in the diagram's settings. A connection then stays only when the code that makes it changed: a method the pull request changed that uses another file, or a changed line that names what it connects to — an import the change added or now uses, a base type, a parameter's type. Make it the default for every diagram in Settings › Diagram.
Closing a file you opened from the diagram brings the diagram back — closing a tab returns to the tab you were on before it, the diagram, the comments or the overview as much as a file — and Back (⌥←, or the mouse's back button) does too.
Controls
| Control | What it does |
|---|---|
| + / −, Fit all, Reset view | Zoom in and out, fit everything on screen, start again |
| Reset layout | Put blocks you dragged back where they were |
| Flat view / Tree view | List a project's files flat, or by folder |
| Diagram settings | Hide unchanged members, Hide connections of unchanged code, Show user comments, Show AI comments; Show change statistics; Open files in a tab or a modal |
Where to find it
| App | Where |
|---|---|
| Desktop app | The Diagram tab beside the open files, or ⌥3 |
| JetBrains | In development |
| Terminal | D on the review screen; 1–6 filter the kinds of connection, u hides unchanged members, U the connections of unchanged code |