Long scripts are hard to read, common patterns take too much space and it's from hard to impossible to make important non-common parts to stand out.
Common solution in other dev envs
In other development environment this is usually solved by macros or inline functions/procedures/subroutines
Suggested solution in FileMaker Pro
To achieve the same effect (hiding common patterns) without too much development effort on the FMI side and without having to change the file format etc., I suggest using special flag in comments and only change the visual representation in the Script Workspace, as demonstrated on the attached illustrations.
Current common practice looks like this:
This could be the collapsed and much more readable view:
Of course, you can probably implement it in a safer and more reliable and user friendly way, this is just to demonstrate the concept.
In any case, I hope some script readability tool of this or similar kind appears in FMP rather sooner than later as it would save a lot of development time and even more troubleshooting time.
Please do not confuse with the "collapsible section" feature request.
The key part of this suggestion is that the script steps inside (between the starting and ending part) would remain visible in the collapsed state.