DEV Community

Henning Dieterichs
Henning Dieterichs

Posted on

Create Diagrams In VS Code With

Diagrams are a great way to communicate ideas visually and can be used to extend or sometimes even replace textual documentations of software projects. This article describes how you can create diagrams without ever leaving VS Code.

Use Cases

Here are some use cases for diagrams. Maybe they inspire you to use diagrams more often!

  • Documentation of how large scale components depend on each other: Documentation of how large scale components
  • Highlighting relationships between classes: Class Diagram
  • Wireframes: Wireframe
  • Page Transitions using Screenshots: Page Transition Diagram

You can use diagrams for much more!

All those diagrams have been created with in VS Code.

Create Diagrams in VS Code

To create such diagrams in VS Code without ever leaving your editor, you just need to install the Integration extension from the Marketplace:


After installation, you can simply create a *.drawio file in the explorer view:

Create Diagrams

From there you get the typical interface where you can draw your diagrams:

Edit Diagrams

You can even use git to track changes of your files!

Themes offers multiple themes that you can use in VS Code:

Themes Demo

Create Editable SVG Diagrams

You can either directly create a *.drawio.svg file instead of *.drawio or convert any existing diagram to an SVG file. Such SVG files are still editable diagrams! You can embed such diagrams in Markdown files and even view them on github. Conversion to PNG is also possible!

SVG/PNG Conversion

Code Links

With code links, you can associate code with your nodes or edges by just naming the node like the name of a class or function and prepending the name with #. So if you class is MyClass, the node should be called #MyClass. You also need to activate code links in the status bar. When you double click on a node with such a name, you jump to the class!

Code Links Demo

Collaborative Editing

With Liveshare, you can even edit diagrams collaboratively!

Collaborative Editing Demo

Much More has much more to offer. You can use LaTeX for formulas, add free-hand drawings or paste screenshots from your clipboard right into the diagram!
All these features are also available for in VS Code!

Top comments (2)

eagarciaj profile image

Hi, thanks for your info. In my case I try to link a symbol to code as you mention but display a pop up messsage "No symbol found with the name "loop". Maybe you need to load the symbols by openiong at least one of its code files?"
I have open a project with main.cpp, using platformio with the loop function on the file.
I create the main.drawio file in the same folder than main.cpp (/src)
There's some extra requirement for platformio? or what I missing up?
Best Regards,

winstonpuckett profile image
Winston Puckett

I was literally just thinking, I wish I could do in vs code... But that's impossible so I'll search for any way to do diagrams... This is so incredible! Thank you so much for developing it!