Sublime Forum

Code Folding depends on correct indentation?

#1

I’m a little bit confused. In ST2 Code Folding doesn’t work correctly when the indendation is not correct? This happens in html and in css too. When i unindent all to the left there is no Code Folding at all. When a single thing in a css file is not correctly indented the Code Folding is completely messed up. Whats wrong here?

Mario

0 Likes

#2

Wrong, probably your indentation :stuck_out_tongue:. no joking… folding based in indentation is an smart way, works in every language, not complicated, and even works in files, logs, dumps files, whatever format/language your file is.

0 Likes

#3

This would be right, if ST2 had a functional automatic indentation command. The “Reindent” command only works in HTML. In a CSS file it produces crap.

So why the “one and only” Editor is not able to perform Code Folding independent of the indentation. :wink:

0 Likes

#4

Write your own indentation rules.

0 Likes

#5

I’m guessing because Jon didn’t get around to it yet.

Afaik, tmLanguage files (as used for source colouring etc.) contain language-specific rules for folding which are presently ignored by Sublime. Foldpoints from indentation is a bit of a cop-out, feels like a “quick and dirty” approach with plans to later improve with “proper” folding. It’s a good fallback solution in the absence of any other lexical awareness; but since tmLanguage files have such info to hand I’m a bit disappointed that Jon hasn’t seen fit to improve this for ST3, together with a facility for saving code folds within a project (or hot-exit) context.

The argument “sort your indenting out” is also a cop-out. It doesn’t help at all when you’re working on other people’s code or following in-house coding guidelines at your workplace, dealing quickly with files whose formatting has been compromised, etc etc… Ironically, working on others’ large source files is when folding comes into its own. Folding as it stands is next to useless for me and just feels half-baked for now. Really hope to see this improve in the near future.

0 Likes

#6

@qgates That’s exactly what i want to say.

Like i said before. I didn’t do “real” coding, just HTML,CSS, Sass and a little bit Javascript. And for these languages i can’t understand the ST2 hype. Fundamental things like Code Folding and suggestions are not working like expected in a 80$ Editor. You’ve to install a HTML5 package if you want to have proper HTML5 support! :astonished: We’re living in the year 2013! Not everybody is able to write his own package or plug-in. And ST3 doesn’t seems to be “better” .

0 Likes

#7

[quote=“qgates”]

I’m guessing because Jon didn’t get around to it yet.

Afaik, tmLanguage files (as used for source colouring etc.) contain language-specific rules for folding which are presently ignored by Sublime. Foldpoints from indentation is a bit of a cop-out, feels like a “quick and dirty” approach with plans to later improve with “proper” folding. It’s a good fallback solution in the absence of any other lexical awareness; but since tmLanguage files have such info to hand I’m a bit disappointed that Jon hasn’t seen fit to improve this for ST3, together with a facility for saving code folds within a project (or hot-exit) context.

The argument “sort your indenting out” is also a cop-out. It doesn’t help at all when you’re working on other people’s code or following in-house coding guidelines at your workplace, dealing quickly with files whose formatting has been compromised, etc etc… Ironically, working on others’ large source files is when folding comes into its own. Folding as it stands is next to useless for me and just feels half-baked for now. Really hope to see this improve in the near future.[/quote]

Exactly my thoughts.

I expect ST3 will implement folding using tmLanguage rules.

0 Likes

#8

I work a lot with XML and python. And that ST3 still can fold independent from indent / unindent is really sad.

I can’t by Tool that can’t do that. All other Editors I know can do that.

0 Likes