Disable saving in Debugging mode

I think it is time to either make this a preference, with the ability to save in Debugging mode turned off by default, or at least make it more difficult to accidentally saving in Debugging mode (multiple warning dialogs).

This feature has always been cool, but I haven’t used it in a long time. I mostly debug droplets by dropping files directly in the script window with debugging on. Now with Mojave changes, other uses of it—such as folder actions debugging—are no longer practical.

This request is not just because more users in the forum are saving in debugging mode accidentally—it has happened to me as well. At minimum, I’d like a warning alert whenever I close script which is presently saved with debugging on. Hmm…maybe this is already an extended preference I have missed? Regardless, thanks for listening.

Anyone else have thoughts on this?

The issue is already flagged for consideration, but apart from the cases where people are doing it accidentally, I think you’re only the second person to call for the change to be made to SD itself.(Disclaimer: I was the first :wink:).

(And no, there no expert preference.)

This has been an issue since v1. People have never understood the consequences of saving when debugging is enabled. SD operates as it does for practical rather than design reasons.

The challenge is enabling/disabling debugging involves a recompile.

If we adopt an approach where we don’t save debuggable documents, SD would have to re-compile on every save to remove debugging. This (a) can slow things down, (b) could introduce user interactions (e.g. property abc : choose folder) and (c ) resets the value of top-level variables.

Moving forward, (c ) may not be a blocking issue but (a) and (b) are.

On the upside, if saving without debugging were a choice, debugging its self could become an always-on thing.

1 Like

The first time scripting in a particular editing session with debugging on, a notification might be good.

Closing and saving a script with debugging on could also trigger a warning.

But I’d hate to see a warning or notification pop up overtime I save with debugging on, and I wouldn’t want to compile for every save.


Further clarification: I don’t mind saving with debugging on. I just want a warning when I close a document with debugging on. Is that feasible?


Indirectly related, I hope it helps:

I’m working on a git-filter, so you can work on an scpt file and the text-version is committed to git instead of the binary file. This filter has a safety feature to decline commit when you saved the debug-version.

This is certainly feasible, but we’ll have to do this carefully. At least in my workflows, almost all of my documents have debugging enabled and adding a warning-on-save could become deeply irritating. Shane and I will see if we can find a workable middle ground on this.

I’d be perfectly happy for Debugger to save two copies of every file. All I’d want to specify is the file type (text, script, bundle, app, or enhanced app). Enabling or disabling debugging wouldn’t even need to be an option—files would always be saved both ways, side by side in the target folder. The “bug” icon would show me which is which, so I’d simply open whichever one I want.

I suppose this would require two compilations per save, so may not be good for everyone. If nothing else, this method of dual-saving might be a nice option.

Stan C.

When I think about it, warn-on-close would be adequate. With a don’t-show-again-checkbox and a preference in SD preferences would please everyone?

I’m late to this party, but I would really like to be able to set a preference to show the alert as Ray requested.

If I am building a new project and developing called scripts, I want to save with Debugging 90% of the time. But once the project goes live, and I need to debug during production mode, I need the alert as I wind up saving with debugging on at least half the time. Of course this stops the live process in it’s tracks, and then I have to stop what I’m doing to simply open the file and resave with debugging off.

I would not want additional dialogs. It is very rare that I unintentionally save in debug mode. Part of the test workflow should be:

  1. Debug in your test environment
  2. Then test outside of debug mode in test environment
  3. Then deploy to production.

That step of making sure it runs outside of debug mode helps prevent the accidental saving/deploying in debug mode.