Add codeFolding to IDE
This will add optional code folding to the script editor. It adds a field "Folding" to the right of field "Numbers" in which folding status is shown (open, folded). Clicking on a line with a symbol for folding will toggle folding status for that struct.
Code folding is an option appended to the Edit Menu when in Script Editor. Can be turned on and off there in the same session of editing. Folding preference is saved when quitting Livecode.
Keyboard shortcuts are command K for Collapse all handlers, command U for Unfold will unfold all handlers and other folded structs. Furthermore command-clicking on the first line of a foldable struct will toggle folding state for that struct.
Foldable are all handlers, if, else, repeat, switch, case, try and "#<" #< is begin of a block comment and has to be closed with #</ on an arbitrary line.
Nested foldables structs can be folded manually and unfolding the parent struct will not unfold the substruct.
Folding slows down the Script Editor, depending on your hardware and the length of the script.
Up to 5000 lines is ok, beyond that it gets a bit sluggish. This affects mainly making a new line since the script has to be rescanned for foldables and changing tabs in Script Editor. Typing is not affected.
What about non-inline block comments? If /* ... */ spans multiple lines, that would seem to be an ideal thing to fold.
Hi @BerndN, I have taken the liberty of rebasing this on develop to remove the conflicts - I hope that's ok. If you want to make tweaks to this PR, you should be able to just do them in the normal way via the web interface, as long as you are on the patch-3 branch (i.e. navigate to files in https://github.com/BerndN/livecode-ide/tree/patch-3/Toolset/). When you make a commit there, it will be added to this PR.
I think
changing a currently submitted pull request will result in just showing the differences from the original pull request
is not true... although admittedly I have not done much in the web interface myself.
Anyway, the reason I was looking at this is that we are preparing various things for the first DP of 9.5, and I was wondering if you wanted to try and get it merged :-) It would be a very cool feature to add!
@livecodeali I will try to incorporate my recent changes to Folding into this pull-request. If I can't manage that I will do a new pull-request against develop and close this one.
@livecodeali I updated the pull-request to the latest features of code folding. (It took me several attempts for some unfortunately) Then I copied the seven affected .livecodescript files and installed them into LC 9.0.4 RC 2 as a round-trip test. It worked. Code folding was working as expected. I also turned on grevdevelopment and no errors reported.
So I think I will not do a new pull-request but recommend this one for review.
had to add empty quoted literals to foldAll. Otherwise strange things in quoted literals (especially /* or */) could cause malfunctions
9.5 seems to be a dead end. Can this be merged into the 9.6 stream?