paulclinger wrote:
There is one more complication though; you probably only want to save changes when they are valid, right? Because if 2s interval falls on you typing something you may be in the middle of a statement and this may break your live code (depending on how it's implemented).
Hmm.. for my part I don't think that this gonna be a big problem. I'm using the lurker library by rxi. This one is checking if the code is valid and if not it goes into it's own error state and automatically return to the program when the error is fixed.
So I think it is optionally. But if you'll be cool with going the hardcore way and implement something like that into ZeroBraneStudio, then that would be even better.
> This one is checking if the code is valid and if not it goes into it's own error state and automatically return to the program when the error is fixed.
@MadByte, I posted a plugin that should do what you wanted (save every X seconds while debugging). You can configure it as "savealleveryxdebugging.interval = 10"; 3 seconds by default.
You'll need the latest ZBS as it includes some API calls that this plugin is using.
> But if you'll be cool with going the hardcore way and implement something like that into ZeroBraneStudio, then that would be even better.
This is exactly what ZBS live coding does . It validates the file before sending the updated content over to the application. It includes one editor tab by default, but you can add other tabs (right click and select "Add to Scratchpad").
(2014/4/19: updated plugin URL as it was renamed based on the discussion later in this thread.)
Last edited by paulclinger on Sat Apr 19, 2014 5:45 pm, edited 1 time in total.
Unfortunately I have some problem with the plugin. When I added the plugin the first time I got an error because I forgot to add your API changes( the src directory ). So it seems like it gets loaded as it should. Now I downloaded the new ZBS project from GitHub and replaced mine.
Now I don't get any error, but when start debugging it looks like the plugin does not work.
I start debugging with F5.
To test the plugin I just changed a color value which effects everything on screen and don't pressed ctrl+s because this should be done automatically, but nothing happens.
in order for the debugging to actually start. Auto saving does work then.
However I noticed I can't edit any file while the debugging session is active, which renders the auto saving useless.
hmm thanks for clarifying that.
For me when running "as Scratchpad" the saving does work and I can change the code without problems.
But isn't there an easier way to tell the editor that it should do the same as pressing ctrl+s and that every X seconds while the program is running (preferably with F5 because it is declared as "Start debugging")?
tbh I don't really want to use the scratchpad nor extend my code with the "require("mobdebug").start()" part because for some reason the program freeze everytime I start in the wrong mode (F5) which is a little annoying. Also I experienced that when using it, the program can run really really slow from time to time. Anyway if there's no other way to do that I'll be fine with it. Thanks.
> I noticed I can't edit any file while the debugging session is active, which renders the auto saving useless.
@SneakySnake, Yes, I made couple of assumptions that I didn't clarify, which turned out to be incorrect.
There is an debugger setting that allows the user to continue editing files, which I thought MadByte was using: "debugger.allowediting = true". It was added to specifically handle this case when you have an external synchronizer that refreshes files.
> I don't really want to use the scratchpad nor extend my code with the "require("mobdebug").start()"
@MadByte, yes, that was the second incorrect assumption I had, that you run a normal debugging session.
I can definitely check for simply running the script (and not being connected to the debugger), but need to add another API call for that.
@MadByte, I updated the condition in the plugin (and renamed it as the logic has changed). It should now better do what you expected . You still need the latest ZBS as I added one more API call.
paulclinger wrote:@MadByte, I updated the condition in the plugin (and renamed it as the logic has changed). It should now better do what you expected . You still need the latest ZBS as I added one more API call.
The file only seems to be renamed, not updated. The condition is still ide:GetDebugger():IsConnected(), and even the description is the same.