PlantUML With VSCode
PlantUML is a super awesome tool where you can specify your UML diagrams in a text format. It is open source and has a rich library to generate diagrams for all your UML needs. Here are my thoughts on why PlantUML is awesome. I prefer VSCode as my default editor and installing PlantUML for VSCode is a matter of installing few plugins. Here is what you need:
Now open a new document, paste the following code and save it as hello.puml, the valid extensions are *.wsd, *.pu, *.puml, *.plantuml, *.iuml, .txt
'Everything that starts with a simple quote 'is a comment. You can also put comments on several lines using/'to start and '/to end. 'Start of UML diagram @startuml header Awesome PlantUML footer Page %page% of %lastpage% title Sequence Diagram ' Scale determines the size of the output scale 1 ' A single dash in the arrow gives solid line Alice -> Bob: Authentication Request ' A double dash in the arrow gives dotted line Bob --> Alice: Authentication Response Alice -> Bob: Another authentication Request Alice <-- Bob: Another authentication Response @enduml ' End of UML diagram
Save the file and run it using Alt+D or open up the Command Palette (Ctrl+Shift+P) and type PlantUML, you would see the following:
Select the Preview Diagram option, now you can see the split pane with the diagram. You can edit the plantUML code and the image would render instantly giving an immediate feedback loop.
2 thoughts on “PlantUML With VSCode”
There was a great man said: “Right tool for the right job is the essence of productivity”