Disable "Show Code Folding" for new documents created via script

Hi, I’m creating new documents via script (to automatically add the current date).

I’d like to disable Show Code Folding for them but can’t find a way to do that.

Here’s my setup:

  • Created a template

  • Set preference General > For New Documents to it

  • Set this template’s view for all new documents via menu
    Window > Set Default Script Size & State

Now, when I use File > New Script I get exactly what I want, i.e. Show Code Folding is unmarked.

However, when I create a new document via script it doesn’t respect the disabled Show Code Folding.

I found a post from 2017 that says it was possible to add a HideCodeFolding key to a template’s plist. Tried with Script Debugger 8, doesn’t work (anymore?), but that may be due to the fact that the post didn’t explain what the key’s values can be.

Am I doing this wrong or is it not possible to hide Code Folding for scripts created via script?

For historical reasons, code folding is a document/template setting rather than a view setting.

You can turn code folding off or on in a template by adding a SDHideCodeFolding key with a boolean value (true/false) to your template’s TemplateInfo.plist file.

This doesn’t seem to work. Restarted Script Debugger, no luck.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">

@alldritt not sure if you’ve seen my reply as the thread was already marked with “Solution”

Please check out the 8.0.1 beta release:

1 Like