5

Possible Duplicate:
Automatic code reindent button

I often see questions with a lot of messy code thrown in. It's hard and unpleasant to dig it, and sometimes even hard to even understand what is done there.

Is this a good idea to make "Prettify code" button in the editing interface which inserts/removes line breaks and do the proper indentation?

2
  • 9
    It would be nice, but what would the options be? How would the "language" be determined? Whose style guide should be used?
    – Oded
    Commented Dec 17, 2012 at 18:20
  • 5
    Most decent IDE's have this capability and most users already have an IDE that is better suited to the languages that they use and therefore interact with on the site. Implementing this for "all" languages on the site would be quite an undertaking...
    – Lix
    Commented Dec 17, 2012 at 18:36

2 Answers 2

12

I don't think this would solve the underlying problem, which is that some people (thankfully relatively few) do not put as much effort as they could/should into writing their questions. Even if the code were auto-formatted nicely (which would be quite a challenge to do in such a way as to please everybody), it wouldn't fix the rest of the rambling, typo-strewn, unfocused content. (So maybe we need a 'prettify post' button that gets rid of personal complaints, extra punctuation, and fixes word choice, spelling, etc. :) )

For people who want to ask a good question or give a good answer, the burden of code formatting is very small compared to coming up with a good post.

In some ways, it's actually helpful to see a poorly formatted post. If the asker is unwilling to put forth the effort to format it reasonably, it's a good indication that the question is not worth your time.

2
  • 1
    Almost in agreement, except that new users frequently misunderstand the formatting options available in the editor, and new programmers (and hobbyists) often don't yet even recognize the importance of code formatting and indentation at all. Commented Dec 17, 2012 at 18:59
  • So it is worth my time to help them improve their question, if it turns them into a valuable contributor somewhere down the line, and helps them improve their own coding practices. Commented Dec 17, 2012 at 19:00
1

I use this script to have tab indent instead of moving focus and i really like it to indent code well ( and other users are not confused )

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