I’ve been using Sublime Text as my editor of choice for about a year. Every now and again I install another little plugin to help out.
For my current project we’ve been using plantuml to build sequence diagrams and UML models for the data structures.
I had a bit of a search round for a suitable plugin that would use plantuml to generate the images on the fly from with in Sublime. I found this project on github that looked perfect.
It was working fine, but it had 2 small niggles, the first was that it called out to Eye of Gnome to actually display the images which was a bit of a pain. The second is the random chars it appends to the end of the file name for the images it generates.
There was an open issue that seamed to described the first issue problem and a comment from the original author stating that he didn’t have time but would welcome contributions. I thought I’d have a look at seeing how hard it would be to add what was needed.
It turned out to be very simple:
from .base import BaseViewer import sublime class Sublime3Viewer(BaseViewer): def load(self): if not sublime.version().startswith('3'): raise Exception("Not Sublime 3!") def view(self,diagram_files): for diagram_file in diagram_files: sublime.active_window().open_file(diagram_file.name)
I’ve also tweaked the code to remove the random chars in the name for my version but I’ve not checked that in yet as I don’t think the upstream author will accept that change at the moment.
In the meantime you can install my version direct from my git repo with the following steps
- Open the Command Pallet, Tools -> Command Pallet
- Select Package Control: Add Repository
- In the text box add the git repo address and hit return – https://github.com/hardillb/sublime_diagram_plugin
- Open the Command Pallet again
- Select Package Control: Install Package
- Type in “sublime_diagram_plugin”