PlantUmlViewer icon indicating copy to clipboard operation
PlantUmlViewer copied to clipboard

Refresh when saving file

Open BHMath opened this issue 1 year ago • 4 comments

Description I'd like to have the preview refreshed everytime I save my file

Solution When I save my file (CRTL+S) the preview would be refreshed

Alternatives Currently I save then I move my mouse over the refresh button then I click it

Additional information Maybe add this feature as an option to allow a user choice

Thanks ahead. This plugin is amazing !

BHMath avatar Mar 07 '23 14:03 BHMath

Hi @BHMath ,

thanks for your your proposal. Generally I am a little bit feared of overloading shortcuts or commands since this could (and will) cause some confusion. Shortcuts should always behave like expected, especially standard ones like CTRL + S. A user should be always able to use a software in such an intuitive way that no documentation would be necessary (in theory :-) ... ). But let me propose a potential alternative: Are you already aware of the shortcut mapper? You are able to define custom shortcuts for every command, also for refreshig the PlantUMLViewer plugin. shortcut mapper This way, you could define a dedicated shortcut for the diagram generation. It would be not the same shortcut like used for saving the file but it prevents confusion and is definitively a very elegant and handy solution.

BR, Philipp

Fruchtzwerg94 avatar Mar 08 '23 17:03 Fruchtzwerg94

Oh right didn't thought about making my own shortcut. What I meant was more a trigger on plugin side. Like every time the file is saved (from shortcut or via File menu), the preview is refreshed.

What do you think about this ?

BHMath avatar Mar 09 '23 20:03 BHMath

I already thought about a feature like "autogeneration" which allows to trigger the generation during typing. This is quite similar to your request from a implementation point of view. Unfortunately there are some non trivial things like

  • How to handle saving multiple times during generation
  • How to handle changed files
  • How to handle failed generation
  • ...

to be taken care of. These details should be handled wisely since they could lead to some strange behaviours and unstable behaviour. For now the feature is on my whish list but I have no concrete plans to implement it. But if I am going to do it, I am also going to think about some kind of "switch" where you can select between generation at typing, at saving and maybe other options. Definitively something for a later release.

Fruchtzwerg94 avatar Mar 11 '23 21:03 Fruchtzwerg94

Perfect ! If you like to discuss about the how, I'm yours. Good luck with the next

BHMath avatar Mar 13 '23 08:03 BHMath