What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 131 Stack Exchange communities.

I have a been an active member of SO for about a month so far. One of the most common edits I do every day is normalizing spaces in code posted by new users (very rarely - old users). I probably spend at least 15 minutes every day doing it. For example, OP posts something like this:

     {
              //code goes here
            }

What I do is go and manually fix it to this:

{
    //code goes here
}

With three lines, does not look like a big deal, but if the code spans several pages, I would not even bother. Sometimes it will stay like this forever, because nobody bothered. It gets the answer, it's accepted and later being referenced by veterans of SO. It certainly does not look very cool, but nobody does anything about it.

It would be useful for me as well (even though I am not a new user), because when I post VB.NET code, it gets indented by 2-4 spaces automatically (by VS). When I format it as code, it gets extra spaces, which I need to remove. Not a big deal, if I never change the code, but I do sometimes change it 3-4 times, when there is a problem reported with it. And every time I paste back from VS, I need to manually remove spaces.

I suggest to have this option automated, for example available from the editor, could be near the format as code button. If it's very hard to implement, please suggest a workaround, i.e. a website that reliably normalizes popular languages. Should support at least VB.NET, C# and XML.

share|improve this question
3  
Some languages are parsed based on how many spaces you have - what you are asking for, then is a prettifier & pretty-printer built-in to SE which has support for a lot of different languages? Seems like it's not worth the hassle it'd cause for questions which need that extra spacing. –  Richard J. Ross III Nov 2 '12 at 14:13
    
@RichardJ.RossIII: languages like python - I understand. Maybe not aim at all languages for the start. Count by tags, whichever is most needed. Then probably C# will go first. If you don't think it's needed, gather statistics on how many of the new questions are properly formatted and how many are not, then make a decision yourself. –  user199936 Nov 2 '12 at 14:32
2  
It especially bothers me when a Python question gets posted with messed up indentation. –  NullUserException อ_อ Nov 2 '12 at 16:16
    
@NullUserExceptionอ_อ: It extra-especially bothers me (just kidding, it's actually kinda funny) when well-meaning people edit whitespace-sensitive code to "fix the formatting" in a question where the indentation error is the cause of why they're asking the question at all. I've seen this once or twice and fortunately someone else re-broke the code. :] –  McCannot Nov 2 '12 at 16:25

You must log in to answer this question.