Sublime Forum

Gutter button or fold by scope

#1

Hi,
Is it possible to enable folding by scope? I searched about it and the only answer I could get was that sublime didn’t support at the time but the topic was old. If not possible, how can I create buttons in the gutter to substitute the folding markers? The examples that I could find, were only adding icons.

For example:

namespace SomeNamespace;
Some code here...

namespace SomeOtherNamespace;
More code here...

The body of the namespace is implicit and most people would not indent because of framework style guides, psr, etc…

Thanks

0 Likes

#2

It’s still not possible.

You can fold any current selection however, so manually selecting what you want to fold and then hitting the key chord that is bound to fold the selection will do (different binding on different platform).

Or write/install a plugin that automates this for you.

0 Likes

#3

Ok thanks man

0 Likes

#4

hey @borela, apologies if this is a useless suggestion, but if your code style/language allows it, you can try indenting all the code under comments, which should make the cold folding work, like so:

# block one
  namespace SomeNamespace;
  Some code here...

# block two
  namespace SomeOtherNamespace;
  More code here...
0 Likes

#5

Thanks man, I like your idea but I can use it because of the project’s code style which is a mixture of PSR2 and old source code :pensive:

0 Likes