Add Live-Reload on save command, add some helper functions to clean up#6
Add Live-Reload on save command, add some helper functions to clean up#6GavinRay97 wants to merge 2 commits into
Conversation
|
Hi, @GavinRay97 , thanks a lot for your contribution. I think this can be very useful, and really like it. I think we should consider having this as a setting, instead of as a command toggle that gets forgotten on exit. What do you think? I would intuitively expect this kind of behaviour to be controlled by a setting, not a command toggle. But perhaps you have a different use case in mind? And then, later, perhaps we can also add another setting to have the opposite: that every time that people run the code, it gets saved. What do you think? Also, thank you for the refactoring! |
|
I think that could be a solid user experience too 👍 Admittedly I was trying to hack out a quick first-implementation (and the toggle made it easier to test) but I agree that if you're using this feature, you probably just want it as the default behavior. |
|
So, would you mind adding the code to use this as a setting? Then, we can merge it. |
This commands adds a new toggle which hooks
workspace.onDidSaveTextDocument()to automatically update the loop in Sonic Pi when the buffer is saved. Also two smaller commands are added,tryGetFirstRubyDocument()andrunTextEditorCode()which led to a bit better code re-use and less clutter inextension.ts.Hope someone else finds use in the Live-reload feature 😃