3

Is it possible to add auto indentation for code.

For example:

do
{
for(;true;)
{
}

}while(true);

The nested scope isn't auto indented. I have to do it manually. Is it possible to add the feature or it exists already?

6

It is hard enough to find a library that will tidy up HTML, then you need to prettify JS within HTML files, and on top of that CSS. That's only considering core web development.

Then you have SQL formatting, C#, VB.net, *nix scripts, dos batch files, Delphi, Haskell, Perl, Python, Smalltalk, Ruby...

Each with its own language specification. For some languages, the formatting itself defines code blocks (begin-end), so you really don't want to guess on those ones.

Even if you can find a good formatter for EVERY SINGLE LANGUAGE StackOverflow1 supports (and that means all and sundry under the sun), can you even get developers to like the implicit formatting rules imposed by SE?

1 That is without even considering all the other sites on the SE2 sites that share the same engine

  • So, can we hop on this or what? – Won't Mar 25 '11 at 15:19
3

Here is a customized version of jsbeautifier's userscript, that does your example code from,

enter image description here

To

enter image description here

Install - Source

  • only tested on chrome 11 dev, firefox 3.6
  • I have only @included http://*stackoverflow.com
  • might have some issues with existing syntax highligher
  • I went to the site, but not quite sure how to use it. Is this some kind of plugin? – Shamim Hafiz Mar 25 '11 at 10:50
  • @Gunner, yeah, thats browser extensions, use to called greasemonkey or userscript, more info here stackapps.com/tags/script/info, but currently, above script has some issues with existing syntax highligher script in stackoverflow, so I am not recommand to install that at the moment. – YOU Mar 25 '11 at 10:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .