how to use the plantUML preview in VSCode?
Asked Answered
M

7

39

I am trying to use plantuml add-ons on VSCode: there are several but none of them is working. In this eample I am using the plantUML add-on.

the extension I am using

My VSCode

As you can see on the second image the preview is blank.

Can you help me ?

Motheaten answered 19/11, 2021 at 19:21 Comment(0)
C
68

I had the same issue. My preview started working right after I installed the Java Runtime Environment (JRE).

Cheeky answered 22/11, 2021 at 13:37 Comment(3)
Thank you Bruno, I had same issue and installing JRE and reopening vs-code after worked.Zenobiazeolite
For Ubuntu users: sudo apt install default-jreLorilee
I also to install sudo apt install graphviz and sudo apt install default-jre on Ubuntu 24.04.Chlorohydrin
M
7

On windows, you can now use chocolatey:

choco install plantuml

You then have to restart VsCode for the previewer to properly work.

Mountaineering answered 1/2, 2023 at 5:56 Comment(0)
S
6

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.

Subatomic answered 28/5, 2022 at 9:34 Comment(1)
This only tells OP how to generate a preview, that is not their problem. Their problem is they asked the extension to generate the preview but the extension didn't do it's job of generating the preview. @Bruno's answer tells them how to fix the generator failing.Wharfinger
P
4
  1. Download Java Runtime . Click "Instructions"

  2. Install graphviz

sudo apt update
sudo apt install graphviz
  1. Enjoy
Polarimeter answered 30/7, 2022 at 21:27 Comment(2)
this seems like an incomplete answer?Engleman
I also to install sudo apt install graphviz and sudo apt install default-jre on Ubuntu 24.04.Chlorohydrin
S
4

The answer is right, however there is another issue too. I am going to post here the other issue for anyone wandering, because that issue is not on stackoverflow.

If you find the error:

  • "No valid diagram found here!"

Than here are the answers:

In short:

  • As mentioned here, try to put the cursor somewhere between @startuml and @enduml, and then press ALT + D to open the preview. If the cursor is outside of the @startuml @enduml block, the "No valid diagrams found here!" error occurs.
Smokeless answered 6/4, 2023 at 15:15 Comment(0)
M
1

My local server doesn't want to render. I changed server to plantuml.com See details here: https://skalolaskovy.ru/analytics/65-system-analytics/603-vs-code-does-not-generate-diagram (russian lang.)

Maihem answered 5/9, 2023 at 9:58 Comment(1)
Thank you! My local JRE installation was blocked and this way I was able to generate previews :)Tanberg
T
0

If you use plantUML on VSCode with WSL remote, try this :

sudo apt install plantuml
Thoughtout answered 13/6, 2023 at 12:35 Comment(2)
An alright alternative, but OP is asking about the VS Code extension.Lecia
this answer solved the problem in a round-about way by installing java if it isn't already installed. The accepted answer is a more direct solution. The VSCode extension comes bundled with the plantuml.jar so it isn't necessary to install it at a system levelLorilee

© 2022 - 2024 — McMap. All rights reserved.