Home

Awesome

PlantUML README

Rich PlantUML support for Visual Studio Code.

Build Status

<!-- [Donate by Paypal](https://paypal.me/qjebbs "If you like this plugin, you can buy me a coffee. Feel free if you don't want to, since it's free!") | [Donate by AliPay](https://github.com/qjebbs/vscode-plantuml/blob/master/images/alipay.png?raw=true) | [PlantUML Document](http://plantuml.com/sitemap-language-specification) -->

Notice

The server render is now very recommended by this extension, since it's much faster and much easier to setup, while the major weakness has been improved:

To make sure you can benifit from this update, make sure your plantuml server enables POST support.

If not, like the official https://www.plantuml.com/plantuml, the extension falls back to use GET, and you may still encounter 414 URI Too Long errors. Setup your own server is recommended.

See also: About Render

Features

Notice: If you use customize plantuml.jar, please update to the latest version to enable Multi-Page Diagram support. (Later than V1.2017.15)

Format PlantUML code is Deprecated. Don't depend on it, use it only when it works right. I had force disable it in auto-format cases (format on save).

Supported Formats

*.wsd, *.pu, *.puml, *.plantuml, *.iuml

How to install

Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.

ext install plantuml

Requirements

Depend on which render you choose, plugin has diffrerent requirements.

Requirements for PlantUMLServer render

A plantuml server. See Use PlantUML Server as render.

Requirements for Local render

It's necessary to have following installed:

Quick Install for Mac

brew install --cask temurin
brew install graphviz

Quick Install for Windows

The plugin has an integrated copy of plantuml.jar and GraphViz, so you are normally good to go. But if you want to use your own jar or a different version of GraphViz (maybe a newer version, or with many dependent jars):

Choco install

For windows users, majkinetor introduced a way to install plantuml and its dependencies easily. Run cmd.exe as Administrator, and run two commands as follows (the first command is not needed and will fail if you already have chocolatey installed).

@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"

choco install plantuml

If you've installed java, but still prompts "java not installed", please add java bin path to PATH environment variable.

Typical Files Organization

"plantuml.diagramsRoot": "docs/diagrams/src",
"plantuml.exportOutDir": "docs/diagrams/out"

You'll get export results like:

Project Folder/
  docs/
    diagrams/
      src/
        architecture_overview.wsd
      out/
        architecture_overview/
          architecture_overview.png
  ...rest_of_your_project_folders/
  ...rest_of_your_project_files 

Include Files Search Logic

Latest version has changed the include files search logic once again. It is possible to configure includepaths now in settings.json.

The new search order is as follows:

  1. The folder of the rendered file
  2. The includepaths as configured in settings.json
"plantuml.includepaths": ["docs/diagrams/style","docs/diagrams/src"],
  1. The diagramsRoot

The setting includeSearch is not needed anymore, since the folder of the plantuml file and the diagramsRoot are always both in the include path.

To new projects, it's recommended not to rely on diagramsRoot and configure all required includepaths explicitly.

Thanks anotherandi for the brilliant idea and implementation!

Preview Demos

Preview page provides various zoom/pan actions and snap feature:

Auto update:

audo update demo

zoom & scroll:

zoom demo

Multi-Page View:

Multi-Page demo

Export Demos

Export diagram:

export demo

Generate URLs

url demo

Extract Diagram Source

extract demo

About Format

format demo

PlantUML formatter is disabled (since v2.8.3) if editor.formatOnSave is on. Because the formatter is not reliable enough according to user feedbacks.

About Snippets

snippet demo

This plugin integrates all type diagram snippets. They are splitted into 9 sections:

For exsample, type acife (short version) to trigge following snippet (activity➤if・else):

if (cond1?) then (val1)

else (val2)

endif

About Symbol List (List diagrams of file)

list_symbol_demo.png

Press Ctrl+Shift+O to list all diagrams in the file. You can name the diagram when diagram starts.

@startuml diagram name sudoku @enduml

About Render

Plugin supports two renders: Local and PlantUMLServer.

Local is the default and traditional way. If you care more about export speed, you should try PlantUMLServer.

Local: 6 documents, 9 digrams, 14 files exported in 24.149 seconds
PlantUMLServer: 6 documents, 9 digrams, 14 files exported in 1.564 seconds

Advantages and Disadvantages of PlantUMLServer Render

Advantages:

Disadvantages:

Use PlantUML Server as Render

To render very-large diagrams with include support, please make sure your plantuml server enables POST support.

If not, like the official https://www.plantuml.com/plantuml, the extension falls back to use GET, and you may still encounter 414 URI Too Long errors.

Setup your own server is recommended.

"plantuml.server": "http://192.168.1.100:8080",
"plantuml.render": "PlantUMLServer",

Multiple languages support

Translations are welcome. lang.nls.json, package.nls.json

languages demo

MarkDown integrating

markdown demo

@startuml / @enduml is still recommended, so that PlantUML code in Markdown can be managed by other function of this plugin.

Extension Settings

This extension contributes the following settings.

Render Select:

PlantUMLServer Render Settings:

Local Render Settings:

Export Settings:

Preview Settings:

Other Settings:

Known Issues

Please post and view issues on GitHub

Thanks

Translators

Donators

Thanks for your encouragements!

Claus Appel, 三島木​一磨, 富吉​佑季, 黒田悦成, Jared Birdsall, Suleyman Cabir Ciplak, Malcolm Learner, Сысоев Максим, Gokan Kenichi, anb0s, Lawrence Yarian, Ahmad Ragab, 山田​暁通


Enjoy!