Sublime Forum

Code folding broken

#1

I don’t use it very often so I don’t know if this is a new problem in build 3103 or not, but PHP comments in the form of
/* something */
are breaking code folding.

0 Likes

#2

This is just your indentation screwing up the fold regions. Sublime looks at indentation as wel all brackets to figure out the start and end of something that should be folded. If you indent the /* comment */ region so it’s inline with everything else inside that function, it should work just as you intended.
Also the fold arrows for /* comment */ are intentional, they let you fold that comment.

0 Likes

#3

Folding with fold arrows is solely based on indentation.

0 Likes

#4

Oh I kinda assumed it also looked at braces. Awesome.

1 Like

#5

Just thought I’d drop this here, since it seems to be the most recent thread on code folding problems.
I frequently have python files with several classes defined, and ctrl+k, 2 folds all the classes rather than just the methods. The fix for this seems to be to search-replace \n\s+\n with \n\n (with regex turned on). That is, use truly empty lines to replace lines with 1 or more white space characters and nothing else.

Here’s a demonstration.

0 Likes