Windows上适用于Visual Studio Code的PlantUML扩展名仅适用于序列图

时间:2018-12-19 17:20:41

标签: windows visual-studio-code plantuml

我已经在Windows的Visual Studio代码中安装了PlantUML extension (by jebbs),并且对于序列图而言,一切都工作正常。

但是,当我尝试呈现图时,我收到消息:

  

可执行文件:\ opt \ local \ bin \ dot
  文件不存在
  找不到Graphviz

完整的错误消息的屏幕截图:

Dot Executable does not exist error

当我尝试指定示例@startuml testdot @enduml的代码时,出现以下错误:

  

环境变量GRAPHVIZ_DOT已设置为/ opt / local / bin / dot
  点可执行文件是\ opt \ local \ bin \ dot

完整的错误消息的屏幕截图:

GRAPHVIZ_DOT has been set error

有什么想法可以指定它,以便我可以覆盖它(假设这是问题所在)?它尚未添加到我可以看到的系统或用户环境变量中。

3 个答案:

答案 0 :(得分:5)

GRAPHVIZ_DOT环境变量在文件>首选项>设置> Plantuml:命令参数中指定。单击链接到“在settings.json中编辑”。

Settings dialog

settings.json

另外 VSCode PlantUML扩展似乎未包含graphviz“ dot.exe”可执行文件,因此需要下载并安装(例如,通过Chocolatey或从{{3 }})

然后,更新路径并保存。

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

另请参见https://graphviz.gitlab.io/_pages/Download/Download_windows.html

答案 1 :(得分:0)

PlantUML的前提条件是Java和Graphviz(https://plantuml.com/starting

您需要这些东西来运行PlantUML:Java Graphviz(如果您选择 只需要序列图和活动(beta)图)

,在Windows计算机中,我们可以下载并提取Graphviz,然后将其放在用户路径中。

答案 2 :(得分:0)

这就是我设法修复 graphviz dot: null 问题的方法:

String adaptedLine = line.stream(). sorted(Collections.reverseOrder()). map(t>String.valueOf(t)). collect(Collectors.joining(" ")); (您可以在左侧找到该选项)

enter image description here

选择您已安装的 graphviz 扩展程序,例如@ext:tintinweb.graphviz-interactive-preview

点击设置

From VSC: Goto EXTENSIONS: MARKETPLACE

如果 VSC 在 Windows 上,则创建一个变量,指向安装了 graphviz 的 dot.exe 的位置。

enter image description here