..folding options in SDK IDE

Hi folks…a bit weird situation, but it seems that i have problems to properly set IDE, on such way that, WHILE and FOR loops are foldable, as well as IF statements…i did plenty of messing with Tools->Options but so far no luck…some code slowly grows, and it is a bit hard to follow trough everything unfolded (methods within class i can fold/unfold, so thats fine)…for instance, on this picture, i have few more screens up and down with mentioned statements and loops unfolded and its much better if i can fold it out and have easier to look/focus editor…i have had this in Visual Studio (C++), and im sure it must be available here…i just dont know how to turn it on…any hint??

You can do Manual folding with some XML Tags in comments.
Google netbeans fold Code should take you there.

I don’t know it by heart I always copy and Paste :stuck_out_tongue:

Sorry, but my english isn’t the best. As far as I understand your posting, you search for a way to “auto-fold” your code. Am I right? In this case you might look into Tools → Options → Editor-Tab → General (I’m using jme3 btw.) Here you can choose “Use Code Folding” (In my case it was checked by default) and after that you can choose the desired “Collapsables”.

If I missunderstood the problem: Sorry for wasting your time! Maybe some admin could remove this posting in this case!

…hello…thank you for assistance…you are not wasting my time, so don’t you worry… :wink: i did try to do all mentioned steps, but none of them giving me ability to fold WHILE/FOR loops or IF statements, which is very handy, as code is kind a long and its very hard to watch code ‘exploded’ like that (im writing some ai routines and its a bit hard to watch all that and i prefer to fold steps done and watch unfolded parts im working on at the moment…)…

Oops, sorry, I got it the other way round. For your case there is an implemented option:

In the following description I use round-brackets instead of the “html”-ones :smile: I don’t know how the triangle-brackets are called and im to lazy to search for it :wink: So you have to replace the ( with a < and the ) with a >. I hope you get what I mean.

// (editor-fold defaultstate=“collapsed” desc=“user-description”)
…any code…
// (/editor-fold)

Everything between these to marks can be collapsed.

Source: Link → CustomFolds

EDIT: Now I learned how to deal with code :chimpanzee_smile:

// <editor-fold defaultstate="collapsed" desc="user-description">
        ...any code...
// </editor-fold>
1 Like

…that works, but its just clumsy way of having such important feature… :slight_smile: now, im wondering, what is the reason that such thing is not implemented in Netbeans…i mean, Notepad++ have it, so whats the problem that Netbeans doesnt have such, for me, important feature…sigh…

You can also type ‘fcom’ and press TAB afaik, it is a shortcut to quickly type the above.

I hesitate to reply because partially this is a style issue and your request is worth pursuing either way.

But as a developer who has been doing software development in various capacities professionally for almost 30 years, I find it interesting that I’ve never wanted or needed such a thing. Granted, some of that is style… but some of it also might be code that could be refactored to be cleaner. So I thought it was worth asking the question.

If your “AI code” is of the giant if/else if/else if variety with huge statement blocks then there are definitely better ways to do that. And some of those better ways are more than just stylistically better… they are actually tangibly better.

1 Like

…i do not doubt that certain things could be done better, or worse…im working on procedural game where npc’s are also fully procedural in sense of their behaving, arming themselves, decision making and generally, building up themselves(its not Minecraft type of building up) up to level where confrontation with player is in npc favor on some way (teaming, patterns, formations,weapon selection/arming, etc)…sort of…so code is long enough to go over one screen, which is…normal i guess…also, my font is a bit larger than default so i can see clearly and to be able to fold IF statements or WHILE loops is a good thing…im not arguing anything but i was surprised to discover that it doesn’t exists, while i had it nicely in VS(C++), and as i mentioned even Notepad++ have it, so some significance in fact that other IDEs have it, must gain some value…