Sublime Forum

Feature Request: C# - Region Fold

#1

Hi.

I noticed that this is not something that is implemented in Sublime Text 3. Thanks for your new version. It is absolutely amazing. :slight_smile:

My request is that when " #region, [Name], [Code], #endregion " is used there is a plus/minus sign on the left to group the code.

Example:

Folded:

  • Name ( in a Box )

Unfolded:

  • #region [Name] ( Name in a Box )[Code]
    #endregion

I was wondering if the default action is the regions to be folded. This makes the code very easy to work with. :smiley:

Thanks.

0 Likes

#2

Bump.

This is important. I use regions all the time. If i can’t fold regions, the code is a mess. If the regions are folded, when you open the code, it’s easy to find your way to a specific part of the code. :slight_smile:

Best regards,
Johannes Hillestad Baumann

0 Likes

#3

have you tried any existing plugins like:
https://packagecontrol.io/packages/SyntaxFold

I guess it won’t show a fold marker in the gutter (unless you indent the contents of your regions), but you could log an issue on that package’s repo to ask for a popup or phantom or something on hover that would allow you to click on it to toggle the fold state.

0 Likes

#4

Hi, kingkeith. :slight_smile:

Thanks for your reply. I didn’t know that there were packages for Sublime Text.

I have tried the package, but it doesn’t fold regions that contains one or more regions inside it.

Another thing is that “#region” and “#endregion” is not made to one line with just a [Name] of the region (box). This way the code is still a mess. The package puts “#region” and “#endregion” together in 2 lines ( and makes a box “…” after the name of the region ).

I think that folding is a very basic thing that should be implemented in Sublime Text. The default behaviour, in my opinion, should be that everything is folded when opening a code. No need to save the state. :slight_smile:

The package has a point though. Shortcuts for folding and unfolding all regions are nice.

If Sublime Text implements this feature, I think that the name of the region should always be in a box, whether it’s folded or unfolded. Double-clicking the box folds or unfolds the region. If there is no name, then “…” is the box ( only when folded ). An additional thing is plus or minus to the left. “{” and “}” should only have plus or minus, and “…” as the name folded ( as folded you can double-click the box to unfold ). :slight_smile: Copying a code from another source into Sublime Text folds the regions automatically. :slight_smile:

I hope that somebody likes the suggestion, so please give some feedback on this issue.

Best regards,
Johannes Hillestad Baumann

0 Likes