SimpylFold icon indicating copy to clipboard operation
SimpylFold copied to clipboard

Newlines seem to break subsequent folds

Open squarebridges opened this issue 6 years ago • 2 comments

This has caused some major problems with my folding. If I'm editing a method in a class, after a certain amount of lines are added (as in, lines of code, with text), the method immediately below unfolds by itself, and the fold marker is lost. When I try to refold it, it tells me no fold was found.

The strange thing is, if I delete the first line of the newly unfolded method, and paste it back, folding seems to be somewhat recovered. Until the next time I add too many new lines above it, and it breaks again.

I've recorded this process happening to hopefully give a better explanation.

https://streamable.com/2w6lu

squarebridges avatar Sep 12 '19 18:09 squarebridges

I'm running into this exact same issue.

I also run into a weird case where the beginning of a fold gets desync'd from a function's def statement, and ends up starting below it. So the function body will still be folded, but the def statement isn't. When I do zc on the function name to try and fold it, it closes the previous fold.

When I used syntax folding I would just run syntax sync fromstart to fix the issue. Not sure how to fix it with simpylfold. I tried running call SimpylFold#Recache() to clear the cache and hopefully force it to re-evaluate folds, but no such luck.

dlobue avatar Sep 18 '19 19:09 dlobue

All these months later... I just recently discovered a way of patching this: zx will re-compute the folds, and they'll be correct from that point on. Bit of a nuisance to have to recompute folds so often, but it beats having to save, close, and re-open the file, which is what I've gotten used to doing over the last 10 months. Hopefully this helps others that come across this.

squarebridges avatar Jul 14 '20 22:07 squarebridges