Skip to content
← Back to Community
Custom Folding Blocks
Profile icon

I am wondering if there is a way to create a custom folding region. I want to be able to collapse my Setters and Getters and other sections of code. I can currently collapse each setter and getter, but that's a lot of work. I am aware of the shortcuts to collapse all, etc. Just wondering if I can define my own regions.

Profile icon
Profile icon
Profile icon

It depends on the language. Python determines folds by indentation. So you can use a comment one indentation short of the code you want to fold and it will create a fold point that will include any code on the same indentation. C# has something called regions which allow you to set up foldable regions: #region #endregion to close the block
This comment section is terrible. Imagine the .'s as spaces and no () around the (#)
..(#) comment label for folded code
....folded code here
....this will be folded
....all of this gets folded
..this isn't folded
#region stuff in here can be folded
folded code here

Profile icon

I don’t think you can. Maybe try putting them in another block of some sort like give them a unique indentation?