Home Download Buy Blog Forum Support

Code Folding depends on correct indentation???

Code Folding depends on correct indentation???

Postby electricarts on Fri May 17, 2013 8:54 am

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
electricarts
 
Posts: 18
Joined: Wed Mar 20, 2013 1:01 pm
Location: Germany

Re: Code Folding depends on correct indentation???

Postby tito on Fri May 17, 2013 10:57 am

Wrong, probably your indentation :P. 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.
Give APIs, let the community build the rest!
https://github.com/titoBouzout
tito
 
Posts: 708
Joined: Thu Sep 29, 2011 2:27 pm
Location: Montevideo, Uruguay

Re: Code Folding depends on correct indentation???

Postby electricarts on Sat May 18, 2013 3:49 pm

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. ;)
electricarts
 
Posts: 18
Joined: Wed Mar 20, 2013 1:01 pm
Location: Germany

Re: Code Folding depends on correct indentation???

Postby tito on Fri May 24, 2013 3:23 am

Write your own indentation rules.
Give APIs, let the community build the rest!
https://github.com/titoBouzout
tito
 
Posts: 708
Joined: Thu Sep 29, 2011 2:27 pm
Location: Montevideo, Uruguay

Re: Code Folding depends on correct indentation???

Postby qgates on Mon May 27, 2013 12:25 am

electricarts wrote:So why the "one and only" Editor is not able to perform Code Folding independent of the indentation. ;)

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.
qgates
 
Posts: 188
Joined: Mon Nov 05, 2012 4:33 pm

Re: Code Folding depends on correct indentation???

Postby electricarts on Mon May 27, 2013 7:50 am

@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! :o 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" .
electricarts
 
Posts: 18
Joined: Wed Mar 20, 2013 1:01 pm
Location: Germany

Re: Code Folding depends on correct indentation???

Postby bizoo on Mon May 27, 2013 9:42 am

qgates wrote:
electricarts wrote:So why the "one and only" Editor is not able to perform Code Folding independent of the indentation. ;)

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.

Exactly my thoughts.

I expect ST3 will implement folding using tmLanguage rules.
bizoo
 
Posts: 859
Joined: Wed Dec 08, 2010 6:53 am
Location: Switzerland


Return to General Discussion

Who is online

Users browsing this forum: ToddFiske, Yahoo [Bot] and 20 guests

cron