peele / plantuml-preview

Atom package.
MIT License
23 stars 13 forks source link

Live Reload Option #5

Open sagidayan opened 8 years ago

sagidayan commented 8 years ago

it will be nice if there could be a setting toggle to enable Live preview, so that we dont need to save the file to see the diagram.

By the way, Nice implementation! :+1:

eduncan911 commented 7 years ago

I'm just an observer chiming in here based on my observations from other plugins that do "live previews."

Other plugins seem to do it on an "interval" - that is, they keep 'checking' the source, and refresh the preview on an interview (or if anything has changed).

I'd imaging this plugin would work the same way - somehow monitoring the source file every X seconds, and if there any changes, re-render.

The perception works because these plugins (Go and Python based mostly), give nearly instantaneous feedback.

I see a few problems with that logic with PlantUML though:

IMO, PlantUML is not a good candidate for Live Previews for reasons stated above. Java apps are too slow to render quickly enough for it to be effective. Or, if you'd rather wait 5 to 10 seconds between refreshes. Personally, re-saving is good enough for me.

The current state of hte plugin would replace the image with errors - thereby removing any "preview" ability. (you'd be staring at more errors than actual diagrams) Maybe if the plugin was modified to display the errors under the last-rendered-image or something.

Another thought would be the run the plugin twice: once to capture any 'syntax' errors, and again to actually render. But now you've doubled the time it takes to run this Java app (looking at 4-6 seconds now).

-- UPDATE:

I just played with the PlantUML extension for VSCode with Live Preview. It... well... kind of works. but with exactly the issues i noted above.

rafaelkendrik commented 4 years ago

I've created a really simple watch to .pu files: https://github.com/rafaelkendrik/plantuml-watch. Actually it is not a robust script, but you can fork it and customize with the tools you what. Fell free to open issues too :)