MCPcopy Index your code
hub / github.com/EFanZh/Graphviz-Preview

github.com/EFanZh/Graphviz-Preview @1.7.5

Chat with this repo
repository ↗ · DeepWiki ↗ · release 1.7.5 ↗ · + Follow
245 symbols 490 edges 26 files 0 documented · 0% updated 2mo ago★ 744 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Graphviz Preview

CI Codecov

An extension for Visual Studio Code to preview Graphviz (DOT) files.

Graphviz Preview screenshot

Installation

You can install this extension from the Visual Studio Marketplace.

This extension requires Graphviz to be installed. Also, make sure that the extension can find the dot executable provided by Graphviz. Either make sure the directory containing the dot executable exists in the PATH or Path environment variable, or specify the path of the dot executable with graphvizPreview.dotPath configuration.

Usage

Open preview

Open the Command Palette (usually by pressing Ctrl + Shift + P), then select “Graphviz: Open Preview to the Side”.

Manipulate preview

Action Gesture
Previous graph P
Next graph N
Zoom in Mouse wheel up / +
Zoom out Mouse wheel down / -
Toggle center position X
Toggle 100% scale Mouse double click / Space / 0
Scroll Mouse drag / Left / Right / Up / Down / A / D / W / S

There are three scale modes: Fixed, Fit and Auto Fit.

  • Fixed: The scale ratio does not change when the source changes or the window size changes.
  • Fit: The graph is scaled to align to the border of the visible view area.
  • Auto Fit: When the view area is big enough to contain a 100% sized graph, the graph will be set a scale ratio of 100%, otherwise the graph is scaled to fit into the view area.

Export graph

To export the generated graph, click the “Export” button on the top right corner.

Configuration

Configuration Type Description
graphvizPreview.dotPath string Path to the dot executable.
graphvizPreview.dotExtraArgs string[] Extra arguments passed to the dot executable.
graphvizPreview.engine string The layout engine to use. Currently, only the dot engine is supported.

Make sure the extension can find the dot program. You can set graphvizPreview.dotPath option to the path of the dot executable, or make sure the directory containing the dot program is in your PATH environment variable.

To set the graphvizPreview.dotPath option, go to File → Preference → Settings.

Known issues

  • After saving an untitled file, the preview becomes invalid.
  • When the scale ratio is too large, the graph may be at a wrong position.
  • Exporting only works for documents that contains a single graph.

FAQ

  • Q: How do I change the layout engine?
  • A: Set graphvizPreview.dotExtraArgs configuration to ["-Glayout=<ENGINE>"], where <ENGINE> is the desired layout engine.

Extension points exported contracts — how you extend this code

Layout (Interface)
(no doc) [4 implementers]
projects/webview/src/layout-state.ts
ChannelSender (Interface)
(no doc) [3 implementers]
projects/shared/src/channel.ts
Engine (Interface)
(no doc)
projects/extension/src/engines/index.ts
LayoutView (Interface)
(no doc) [3 implementers]
projects/webview/src/layout-view.ts
ChannelReceiver (Interface)
(no doc) [3 implementers]
projects/shared/src/channel.ts
ResolveEvent (Interface)
(no doc)
projects/extension/tests/scheduler-test.ts
UiView (Interface)
(no doc) [2 implementers]
projects/webview/src/ui-view.ts
SaveImageRequest (Interface)
(no doc)
projects/shared/src/extension-api.ts

Core symbols most depended-on inside this repo

dump
called by 60
projects/webview/tests/layout-state-tests.ts
toggleIsIdentity
called by 27
projects/webview/tests/layout-state-tests.ts
toggleIsCenter
called by 26
projects/webview/tests/layout-state-tests.ts
setImageScale
called by 20
projects/webview/src/layout-view.ts
setImageDisplaySize
called by 18
projects/webview/src/layout-view.ts
setIsIdentity
called by 16
projects/webview/src/layout-view.ts
toggleIsIdentityAt
called by 16
projects/webview/tests/layout-state-tests.ts
setScale
called by 16
projects/webview/tests/layout-state-tests.ts

Shape

Method 151
Class 38
Interface 26
Function 23
Enum 7

Languages

TypeScript100%

Modules by API surface

projects/webview/src/layout-state.ts34 symbols
projects/webview/src/controller.ts28 symbols
projects/webview/tests/layout-state-tests.ts25 symbols
projects/webview/src/ui.ts19 symbols
projects/shared/src/channel.ts19 symbols
projects/extension/src/preview-state.ts16 symbols
projects/extension/src/preview-manager.ts12 symbols
projects/shared/tests/channel-tests.ts11 symbols
projects/extension/tests/scheduler-test.ts11 symbols
projects/webview/src/images.ts10 symbols
projects/extension/src/engines/dot.ts9 symbols
projects/webview/src/layout-view.ts8 symbols

For agents

$ claude mcp add Graphviz-Preview \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact