Sublime Forum

Code folding not working most of the time (AS3)

#1

Is there a new algorithm for code folding, which is less permissive on some indentation quirks that I’m not aware of?
I never had this problem with ST2. (though I still have the annoying “bug?” that make the block I’m currently in never fold)
I’m surprised I’ve not found any other people having this problem, so it’s probably just with AS3 (Although folding is supposed to be base on indentation only? ), And apparently I’m the only one using ST3 amongst flash devs !
I don’t want to go back!!! Please give me back folding, I just can’t work scrolling hundreds of lines :cry:

*EDIT: OK, Now this is mad! But I gess it will make it easy to fix:
The problem is when you have an empty line or more at the end of a block…
Here’s my block formatting:

function blablabla():void
{
    things...
    // oops, last line empty! Too bad... no folding.

}

Now I will know what not to do but hundred of functions to check… damn!
It would be nice to fix that. Thanks, and continue the great work.

0 Likes

#2

Also, what I’ve found, is that if you have any line with one or more TABs at the end of it, it will stop code-folding in ST3, and sometimes in ST2 as well. It seems the same bug has been back-ported into ST2, which I have reverted to for daily use.
(There is apparently some other factor involved with this bug as well, which I have not found yet, which can mask this condition and code-folding will still work sometimes, at least in ST2.)

The workaround I am doing is to do a “Replace…” (with RegEx turned on) of “\t+$” with nothing.

0 Likes

#3

I just wanted to say that this problem is affecting me too. I am having to make sure there are no empty lines at the end of any blocks.
Using build 3052, but it seems to have been like this in all of the ST3 versions. Thanks.

0 Likes

#4

I’m having exactly the same problem, please fix it :cry:

0 Likes

#5

Still a thing.

Write a new, empty function and Fold All, Fold at Level [X], etc. cease functioning. Put a comment in the empty function and, et voilà, folding resumes its beautiful behavior.

BTW, unfolding still works regardless.

0 Likes

#6

It would be great if this was fixed! It seems to work perfectly fine in Sublime Text2… I find it a crucial feature.

0 Likes

#7

it could be related to how the API that determines indentation level differs between ST2 and 3

I can confirm that no folding arrow is shown in the gutter in ST3 unless there are multiple indented lines that are not only consisting of whitespace, so the following doesn’t show the arrow:

function blablabla():void
{
    things...
    
    
}

but nor does

<?xml version="1.0" encoding="UTF-8"?>
<test>
    hi
    
    
</test>

one can still select the text and fold it though

I hope one day more intelligent code folding will be implemented, but probably these days a plugin could achieve something similar using phantoms on the first column of every line

0 Likes