Got an idea for enhancing SpiderBasic? New command(s) you'd like to see?
Charlie
 
Posts: 5
Joined: Thu Jan 10, 2019 1:54 am
Location: New Brunswick, Canada

"Block" and "EndBlock" keywords to fold "blocks" of code

by Charlie Sun Feb 03, 2019 3:56 am

UPDATE: I've got a workaround that seems A-1 (just not sure about impact on compiled code ...); see later in this thread.

Hello,

If SpiderBasic already has a feature that does this kind of thing, please let me know !

I love (LOVE!) folding/collapsible source code.

Would it be possible to add "Block" and "EndBlock" keywords (or something similar) to allow folding of a block of code ?

I'm thinking the compiler could simply ignore these keywords (i.e. the sole purpose of the keywords: visually folding/unfolding blocks of code).

For example: image

Cheers and best regards !
Last edited by Charlie on Sun Feb 03, 2019 5:54 am, edited 2 times in total.
poshu
 
Posts: 89
Joined: Mon Feb 24, 2014 11:46 pm

Re: "Block" and "EndBlock" keywords to fold "blocks" of code

by poshu Sun Feb 03, 2019 4:49 am

Here I am, traveling through time to add this feature back in SB 1.00!

Code: Select all
;{ FOOOOOOLDING!

;}


And if it's not enough, you can customize folding with keywords in Preferences > Folding
Charlie
 
Posts: 5
Joined: Thu Jan 10, 2019 1:54 am
Location: New Brunswick, Canada

Re: "Block" and "EndBlock" keywords to fold "blocks" of code

by Charlie Sun Feb 03, 2019 5:05 am

I was playing around with preferences, happily adding If / EndIf keywords, which is really awesome.

I just went back in and added ";Block" and ";EndBlock", and that works A-1. Thanks !
  • Yup, I had not clued in that we could have "commented text" as keywords
  • The ";)" and ";)" would have been great hints if I had not been overthinking things (I.e. I was thinking they were some kind of special compiler things; face-palm moment)

Aside: Adding more reserved keywords ("Block" and "EndBlock", or anything else) would be bad for anybody who may be using those words in their code for variables, procedures, or anything else. So, let's ignore my initial request.
Charlie
 
Posts: 5
Joined: Thu Jan 10, 2019 1:54 am
Location: New Brunswick, Canada

My workaround

by Charlie Sun Feb 03, 2019 6:05 am

Just because I find it easier for these old eyeballs to distinguish blocks of folded code from comments: image

  • Block.i and EndBlock.i : the start and end wrappers for a block of code, setup as variables so they don't cause compilation errors
  • Block and EndBlock: setup as custom keywords and added as folding start/end keywords

Does the trick. (Well, remains to be seen what kind of mess I'm creating in the resulting javascript etc. ...)
Return to Feature Requests and Wishlists

Who is online

Users browsing this forum: No registered users and 1 guest