Sublime Forum

Code folding doesn't work - JS, Go, HTML, maybe more

#1

Upgraded my license to install the latest build 4143… and I pretty much can’t use the editor anymore.

Code folding is absolutely unusable. Lots of reports on Github and some here.

Is anyone working on it?

Super sad, but it’s my first time in 10 years to download other editors :frowning:

0 Likes

#2

Does it happen in safe mode? Can you be more specific in how it’s unusable?

0 Likes

#3

It happens in safe mode. See attached image, lines 1-11 and 13-23 are the same code, one open and second one folded. Folding line 3 or 15 will “eat” the “else” and make “else” unfordable.

There are other issues, see second screenshot for something that shouldn’t fold, but it does.

Or HTML’s tag can’t be folded at all - see third screenshot. And within style, indentation based folding is completely gone.

It’s seemingly completely random - clearly different issues per language - which makes work so much more frustrating. I’m sure I saw more issues that I can’t remember now.

  • Aa a new user I can only post one image per post, will attach other screenshots in subsequent replies.
0 Likes

#4

0 Likes

#5

05

0 Likes

#6

@bschaaf I know you’re busy, but could I please get some kind of response? My love for code is slowly turning into hatred :-/

0 Likes

#7

Folding line 3 or 15 will “eat” the “else” and make “else” unfordable.

Basically ST 4143 added a fix to not include trailing newline in folding blocks by default, to avoid this kind of issue. It turned however out it doesn’t work as expected if leading whitespace is involved.

The issue is tracked at https://github.com/sublimehq/sublime_text/issues/5733

There are other issues, see second screenshot for something that shouldn’t fold, but it does.

The second screenshot shows a minified function, which still spans 4 lines of code with a function block beginning at the end of line 1.

Hence syntax based folding applies as expected per design. Note folding no longer relies on indentation levels only but also on certain fold-begin and fold-end markers. An opening brace is such a marker, which denotes the beginning of a fold region.

HTML’s tag can’t be folded at all - see third screenshot. And within style, indentation based folding is completely gone

same as Can No Longer Fold HTML <style> tags

It is caused by indentation based folding being disabled for CSS.sublime-syntax. As source.css starts immediately after <style> tag CSS’s folding rules apply.

A fix is proposed at https://github.com/sublimehq/Packages/pull/3601

I have a feeling we should never disable indentation based folding.

1 Like

#8

Thanks for this.

It folds the second line only - lines 1,3,4 are visible. It is syntax based, but in this case (visually) it shouldn’t be. Are there a plan to go back to indentation based folding? or at least make it as an option?

Meanwhile is there a way to downgrade? I can’t seem to find any solution or download options.

0 Likes

#9
0 Likes