Code Folding

Code folding allows you to collapse a block of code – you can use it  to focus on high-level structure without getting lost in the detail.

To enable code folding enable to option under the Script Editor section of Preferences, found under the File menu.

I use it with my user-defined functions to give me an overview of contents within an include file.  Combined with appropriately placed comments this helps to summarise the contents of a library of functions.  Here is an example:

utility-functions-long

3 thoughts on “Code Folding”

  1. Thank you David for the post.
    is there any place i can get an extensive list of functions for this. i made one for myself but it seems like every time i use a new (for me) function i need to update it manually.

  2. Unfortunately there is no in-built mechanism to get a list of your user-defined functions. There are a couple of DIY approaches: either (1) write a script to scan your JSL files to identify the function names or (2) use document generating software to automatically generate the list of functions (I use NaturalDocs)

  3. Great Post!
    how to keep the folded codes folded? whenever I reopen the scripts, the codes always are expanded…very annoy
    Thanks,

    Daniel

Leave a Reply

Your email address will not be published.