Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PlantUML extension for Visual Studio Code on Windows only working with sequence diagrams

I installed the PlantUML extension (by jebbs) in Visual Studio Code for Windows and everything is working perfectly for sequence diagrams.

However when I try to render a class diagram I get the message:

Dot Executable: \opt\local\bin\dot
File does not exist
Cannot find Graphviz

Screencap of full error message:

Dot Executable does not exist error

When I try the example @startuml testdot @enduml code specified I get the following error:

The environment variable GRAPHVIZ_DOT has been set to /opt/local/bin/dot
Dot executable is \opt\local\bin\dot

Screencap of full error message:

GRAPHVIZ_DOT has been set error

Any ideas where this has been specified such that I can override it (assuming this is what the problem is)? It hasn't been added to the system or user environment variables that I can see.

like image 634
Claire Furney Avatar asked Dec 19 '18 17:12

Claire Furney


People also ask

How do I use PlantUML on Windows?

Go to Settings > Plugins > Marketplace and install the plugin PlantUML integration . Then go to Settings > Other Settings > PlantUML or search for PlantUML. Configure the path to the dot executable. This executable can be found in the /bin directory where you installed GraphViz.

How do I run PlantUML in VS Code?

the solution is: You can open the diagram by hitting ALT + D to preview the PlantUML diagram on Windows and Option key + D on Mac.

How draw UML diagram from VS Code?

Start Drawing Your First Diagrampuml file type and start writing your UML code. You can also see a real-time change of the update by right click on the VS Code script window and selecting “Preview Current Diagram” or hitting “Alt + D” (This option is available for you whenever editing the .


2 Answers

The GRAPHVIZ_DOT environment variable is specified in File > Preferences > Settings > Plantuml: Command Args. Click on the link to "Edit in settings.json".

Settings dialog

settings.json

Additionally the VSCode PlantUML extension doesn't appear to include the graphviz "dot.exe" executable, so this needs to be downloaded and installed (e.g. via chocolatey OR download and unzip from https://graphviz.gitlab.io/_pages/Download/Download_windows.html)

Following this, update the path and save.

{
    "plantuml.commandArgs": [
        "-DGRAPHVIZ_DOT=D:\\Tools\\graphviz-2.38\\release\\bin\\dot.exe",
    ]
}

Also see https://github.com/qjebbs/vscode-plantuml/issues/94

like image 89
Claire Furney Avatar answered Sep 29 '22 20:09

Claire Furney


This is how I managed to fix the graphviz dot: null issue:

From VSC: Goto EXTENSIONS: MARKETPLACE ( you can find the option on the left side)

enter image description here

Select the graphviz extension that you have installed e.g. @ext:tintinweb.graphviz-interactive-preview

Click the Settings

Graphviz-interactive-preview: Render Lock  (Uncheck this one)
Graphviz-interactive-preview: Render Lock Additional Timeout: -1

If VSC is on Windows, then create a variable pointing to the location where dot.exe of graphviz has been installed.

enter image description here

like image 40
Deb Avatar answered Sep 29 '22 19:09

Deb