Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Collapsible functions in IDE
#1
I'm really enjoying the QB64pe IDE but do have one request/suggestion. Hopefully this is the correct forum for this.

I'm working on quite a big project. Not a HUGE project but quite a large one nevertheless. It's just crept over 3000 lines and is becoming quite cumbersome to navigate. I've experimented with splitting sections off into BM/BI files but it feels quite a clunk way of handling things when I'm working on the codebase as a whole and it isn't really suitable to be segmented into standalone libraries.

What would make life a lot easier would be if I could collapse functions, sections, regions, etc.

Anyway, that would be my suggestions but I would also like to comment that it really is a very nice IDE to use. My original intention had been to look for Notepad++, VS Code, etc. plug-ins but there really is no need as it does exactly what's needed as is. Congrats to all the devs involved.
Reply
#2
I'm working with tons of code lines as well. The way I'm navigating is to use a REM statement that is meaningful like "Left Off here" or "Needs a ReThink here" or "Tomorrow to do here". The meaningful comments are endless but generally fewer are easier to remember. Then just use the search feature to find those comments and boom your at the code you want to work on that day.
Reply
#3
Collapsible blocks in the IDE is something we've wanted to add for ages now (along with autocomplete), but nobody's had the time to really look into it seriously and sort out what/where changes would need to be made to accommodate for them.  There's only so many hours in the day, and our devs here all have their own little things that they're working to bring into the language for us, when they find the freetime and motivation to work on them.  At the moment, AFAIK, there's nobody dedicated or working on our IDE except for basic bugfixes when they pop up.  I won't say nobody will *ever* work on adding such features, but there's nobody *currently* working on them.  Collapsible blocks and autocomplete would both have to be in the "long term enhancements" list, in my opinion, so I wouldn't hold my breath waiting to see them pop up in a new release anytime soon.  Wink
Reply
#4
(02-01-2023, 09:48 AM)RokCoder Wrote: I'm working on quite a big project. Not a HUGE project but quite a large one nevertheless. It's just crept over 3000 lines and is becoming quite cumbersome to navigate. I've experimented with splitting sections off into BM/BI files but it feels quite a clunk way of handling things when I'm working on the codebase as a whole and it isn't really suitable to be segmented into standalone libraries.

What would make life a lot easier would be if I could collapse functions, sections, regions, etc.

You're doing it wrong. There is some sense in how the professional C/C++ programmers do things, needing like 50 header files to go with 50 C-extension files. This doesn't only have to do with OOP. However, on BASIC's side I think an adjustment would have to be made toward the MAK-extension files a few people found convenient on QuickBASIC. QB64 is still specific on where certain things should be like initialization areas, subprograms and DATA statements. (I'm trying to indicate a weakness that this programming system has possessed since its inception.)

Using BI- and BM-extension files, sadly, is the only way to cope with the situation. For a big project like QB64PE itself, this is more important than when it came in a single file at least before v0.95.

Hmmm it leads to another feature request: open include file indicated by the cursor, if it's found in the current directory?

If your project is cumbersome to navigate, it must mean the large main loop has to be broken down further into subprograms or into include files. Code-folding is something that allows programmers to become lazy and sloppy. It is so annoying I disable it when I get the chance in Geany, Kate and programs like that. I am against it for the QB64 IDE. It might conflict with the automatic formatting, and you don't want to lose that, do you?

What sucks is that some of those text editors don't have a syntax-coloring and keyword-detection configuration exclusively for QB64. Usually a BAS-extension file is taken to be Freebasic. It's because this programming system has statements added to it in almost every release. So it requires someone to maintain such a configuration file for a given text editor. Keyword detection is not as easy as it might seem: try loading a BASIC file into Kate and observe closely a single-line "IF... THEN" statement.

Have to try not to add something to the QB64 IDE which makes it more CPU intensive. There's a thread going on around here about the IDE sucking up CPU just being left alone, right after it's started. At least for me, on Linux I just can't hold down an arrow key to move more quickly through a single line. Only for this program, I have to disable key-repeat for the whole OS.

Don't take this explanation the wrong way, but if you're complaining the program is becoming unwieldy, then it's time to consider breaking it down so it's more manageable. Because the QB64 IDE was designed for something to compose with, not to compete with VS-Code or any other unwieldy thing.
Reply
#5
Just in case you guys didn't found it yet, here's my Notepad++ config for QB64.
Reply
#6
(02-01-2023, 04:11 PM)RhoSigma Wrote: Just in case you guys didn't found it yet, here's my Notepad++ config for QB64.

Had no idea, thank you for pointing this out. I love the QB64 IDE but often times need a scratch pad to hold functions and other code. This np++ config looks perfect for that.

As far as organizing in the IDE when programming; I have a tenancy of placing finished working funcs and subs at the bottom of the code leaving only the funcs and subs at the top that I'm currently working on. When finished with a project I'll either move them around in a more ordered fashion or in the case of libraries in alphabetical order.

Also, in projects I'll surround subs and functions with a box with the name of it off to the right hand side like so:
Code: (Select All)
'--------------------------------------------------------------------------------------------------------------------------+--------------+
SUB HandleEvents () '                                                                                                      | HandleEvents |
    '+---------------------------------------------------------------------------------------------------------------------+--------------+
    '| Monitor and handle various event happenings throughout game                                                                        |
    '+------------------------------------------------------------------------------------------------------------------------------------+

As I scroll through the code I can look at the tab labels I've created on the right-hand side to identify funcs and subs quickly.
Reply
#7
(02-01-2023, 03:40 PM)mnrvovrfc Wrote:
(02-01-2023, 09:48 AM)RokCoder Wrote: I'm working on quite a big project. Not a HUGE project but quite a large one nevertheless. It's just crept over 3000 lines and is becoming quite cumbersome to navigate. I've experimented with splitting sections off into BM/BI files but it feels quite a clunk way of handling things when I'm working on the codebase as a whole and it isn't really suitable to be segmented into standalone libraries.

What would make life a lot easier would be if I could collapse functions, sections, regions, etc.

You're doing it wrong. There is some sense in how the professional C/C++ programmers do things, needing like 50 header files to go with 50 C-extension files. This doesn't only have to do with OOP. However, on BASIC's side I think an adjustment would have to be made toward the MAK-extension files a few people found convenient on QuickBASIC. QB64 is still specific on where certain things should be like initialization areas, subprograms and DATA statements. (I'm trying to indicate a weakness that this programming system has possessed since its inception.)

Using BI- and BM-extension files, sadly, is the only way to cope with the situation. For a big project like QB64PE itself, this is more important than when it came in a single file at least before v0.95.

Hmmm it leads to another feature request: open include file indicated by the cursor, if it's found in the current directory?

If your project is cumbersome to navigate, it must mean the large main loop has to be broken down further into subprograms or into include files. Code-folding is something that allows programmers to become lazy and sloppy. It is so annoying I disable it when I get the chance in Geany, Kate and programs like that. I am against it for the QB64 IDE. It might conflict with the automatic formatting, and you don't want to lose that, do you?

What sucks is that some of those text editors don't have a syntax-coloring and keyword-detection configuration exclusively for QB64. Usually a BAS-extension file is taken to be Freebasic. It's because this programming system has statements added to it in almost every release. So it requires someone to maintain such a configuration file for a given text editor. Keyword detection is not as easy as it might seem: try loading a BASIC file into Kate and observe closely a single-line "IF... THEN" statement.

Have to try not to add something to the QB64 IDE which makes it more CPU intensive. There's a thread going on around here about the IDE sucking up CPU just being left alone, right after it's started. At least for me, on Linux I just can't hold down an arrow key to move more quickly through a single line. Only for this program, I have to disable key-repeat for the whole OS.

Don't take this explanation the wrong way, but if you're complaining the program is becoming unwieldy, then it's time to consider breaking it down so it's more manageable. Because the QB64 IDE was designed for something to compose with, not to compete with VS-Code or any other unwieldy thing.

Don't take this explanation the wrong way?? Pfft...
Reply
#8
I don't see code folding as an unreasonable request but I'm also not going to be the one having to code such a thing. It could be quite difficult to do. But I don't think it would necessarily be more resource intensive, since code is hidden from display. I could be wrong, though. And if I am, I'm sure someone will be quick to let me know.
Tread on those who tread on you

Reply
#9
(02-01-2023, 04:25 PM)TerryRitchie Wrote:
(02-01-2023, 04:11 PM)RhoSigma Wrote: Just in case you guys didn't found it yet, here's my Notepad++ config for QB64.

Had no idea, thank you for pointing this out. I love the QB64 IDE but often times need a scratch pad to hold functions and other code. This np++ config looks perfect for that.

As far as organizing in the IDE when programming; I have a tenancy of placing finished working funcs and subs at the bottom of the code leaving only the funcs and subs at the top that I'm currently working on. When finished with a project I'll either move them around in a more ordered fashion or in the case of libraries in alphabetical order.

Also, in projects I'll surround subs and functions with a box with the name of it off to the right hand side like so:
Code: (Select All)
'--------------------------------------------------------------------------------------------------------------------------+--------------+
SUB HandleEvents () '                                                                                                      | HandleEvents |
    '+---------------------------------------------------------------------------------------------------------------------+--------------+
    '| Monitor and handle various event happenings throughout game                                                                        |
    '+------------------------------------------------------------------------------------------------------------------------------------+

As I scroll through the code I can look at the tab labels I've created on the right-hand side to identify funcs and subs quickly.

I've seen your code layout and it's beautiful to look at and read. I would say it's a good way you have for navigating while developing without the option of being able to collapse code.
Reply
#10
(02-01-2023, 05:03 PM)RokCoder Wrote:
(02-01-2023, 04:25 PM)TerryRitchie Wrote:
(02-01-2023, 04:11 PM)RhoSigma Wrote: Just in case you guys didn't found it yet, here's my Notepad++ config for QB64.

Had no idea, thank you for pointing this out. I love the QB64 IDE but often times need a scratch pad to hold functions and other code. This np++ config looks perfect for that.

As far as organizing in the IDE when programming; I have a tenancy of placing finished working funcs and subs at the bottom of the code leaving only the funcs and subs at the top that I'm currently working on. When finished with a project I'll either move them around in a more ordered fashion or in the case of libraries in alphabetical order.

Also, in projects I'll surround subs and functions with a box with the name of it off to the right hand side like so:
Code: (Select All)
'--------------------------------------------------------------------------------------------------------------------------+--------------+
SUB HandleEvents () '                                                                                                      | HandleEvents |
    '+---------------------------------------------------------------------------------------------------------------------+--------------+
    '| Monitor and handle various event happenings throughout game                                                                        |
    '+------------------------------------------------------------------------------------------------------------------------------------+

As I scroll through the code I can look at the tab labels I've created on the right-hand side to identify funcs and subs quickly.

I've seen your code layout and it's beautiful to look at and read. I would say it's a good way you have for navigating while developing without the option of being able to collapse code.

Thank you Smile

I've recently changed to this style. It mimics a folder looking structure and stands out much more than the first example I posted. I still use the box structures using "+" and"-" characters for comment boxes within the code itself. They now contrast each other very well, making the subs and funcs pop out much better.

Code: (Select All)
' ____________________________________________________________________________________________________________________________
'/                                                                                                                            \
FUNCTION SL.SHEET.LOAD (Filename AS STRING, SpriteWidth AS INTEGER, SpriteHeight AS INTEGER, Transparent AS _UNSIGNED LONG) ' |
    ' ________________________________________________________________________________________________________________________|____
    '/                                                                                                                             \
    '| Loads a sprite sheet into RAM and returns a sprite sheet array index pointer.                                               |
    '|                                                                                                                             |
    '| MySheet = SL.SHEET.LOAD("MySheet.png", 32, 32, _RGB32(255, 0, 255)                                                          |
    '|                                                                                                                             |
    '| Filename     - the name of the image file                                                                                   |
    '| SpriteWidth  - the width of each sprite on the sheet                                                                        |
    '| SpriteHeight - the height of each sprite on the sheet                                                                       |
    '| Transparent  - the transparent color of the sprite (0 or SL_AUTO to use the image's existing transparency color)            |
    '\_____________________________________________________________________________________________________________________________/
Reply




Users browsing this thread: 1 Guest(s)