vscode-plantuml icon indicating copy to clipboard operation
vscode-plantuml copied to clipboard

Add support for opening and saving embedded code [Feature Request/Idea]

Open chipbite opened this issue 4 years ago • 3 comments

Feature Request / Idea:

Add support for: Opening and saving plantuml code embedded in image files

Background: PlantUML supports creating image files (e g png's/svg's) with the plantuml diagram code embedded in the image file. However, there is (AFAIK) no good workflow for working with the plantuml diagrams in this way, from an editor and preview perspective. Compare this to drawio, which also supports storing the diagram code (in that case, drawio XML) in the image file, but where the editor can open said image file and allow it to be edited and saved/updated - there is a workflow. This idea proposes that the plantuml vs code extension could support and enable such a workflow for vs code, by supporting opening the plantuml diagram code from the image file where it is embedded and saving it back when updated.

  • Goal/Benefit: Keep plantuml code in the image file, allowing the image to be e g used, exported and manipulated as a file, and referenced in a markdown, for instance.

  • What: Create and use plantuml diagrams, having the code embedded in the image file (e g png/svg/etc), in a similar fashion to how you can work with .drawio.png/svg files, as supported by the drawio extension (See https://github.com/hediet/vscode-drawio, or section "Editing .drawio.svg/.drawio.png Files" on https://marketplace.visualstudio.com/items?itemName=hediet.vscode-drawio).

  • How: (if possible) intercept opening of registered file types, such as .puml.png or uml.svg, etc), extract embedded plantuml code and allow it to be edited. Vice versa, intercept save, generate/save updated image file (png/svg) with embedded code option set, as is supported by plantuml.


So

  • opening a test.puml.png in vscode would open the text editor with only the embedded plantuml code.
  • Saving the file would create a render, update the image and the embedded code and save. And of course,
  • previewing the file would work as today, basically.

Thanks for a great plugin!

chipbite avatar Sep 03 '21 12:09 chipbite

With PNG and SVG the source is already embedded, in case you need more info:

PNG: https://plantuml.com/command-line#ce21470ab49d1d19 SVG: https://forum.plantuml.net/5797/please-add-the-diagram-source-code-svg-file-like-done-for-files?show=5799#a5799

fuhrmanator avatar Sep 03 '21 13:09 fuhrmanator

Hi @fuhrmanator - thanks for your reply and reading my idea.
Given your reply I realize that the idea must have been easy to misunderstand, so I have updated the description of the idea to try and avoid others being confused.

Can you help me, is the idea more clear now?

chipbite avatar Sep 07 '21 09:09 chipbite

It's clear to me. I'm pretty busy with other projects right now, but I will be happy to help out eventually.

fuhrmanator avatar Sep 07 '21 12:09 fuhrmanator