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

Possible Duplicates:
Is there any auto indentation for formatted code
Automatic code reindent button

I read a bit of similar posts about indenting code on Stack Overflow, it seems that there's no shortcut key, or icon to format or indent the code.

Could you please add a shortcut key to format or properly indent code blocks?

What i mean is that currently there's only color formatting according to tags.
When you press cntrl+K:

class Blah {
Void func() 
{

}

}

There's no indentation.

Even in stackoverflow with proper tagging, it won't indent the code.

share|improve this question

marked as duplicate by Daniel DiPaolo, Cody Gray, balpha May 28 '11 at 9:04

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
This is a request. Not a question. It was changed to a question as a misunderstanding by an editor. –  Yochai Timmer May 28 '11 at 9:03
    
It's not the same, this is not a question, it's a request... –  Yochai Timmer May 28 '11 at 9:05
    
Please don' add pseudo [tags] to question titles. We already have real tags. –  balpha May 28 '11 at 9:07
    
This is the request. It's already been made. Vote it up if you want to support it. –  Cody Gray May 28 '11 at 9:07

1 Answer 1

There's already a shortcut key: Ctrl+K

The icon is the pair of curly braces in the toolbar: {}

Where in the world did you get the idea that neither of these existed?

share|improve this answer
    
That does not fix formatting or indentation. it just marks the text. –  Yochai Timmer May 28 '11 at 8:41
    
@Yochai: It doesn't "fix" the indentation, what would that even mean anyway? It merely adds (or removes) indentation levels for currently selected code. –  Jeff Mercado May 28 '11 at 8:46
    
@Yochai it does fix formatting in that it indents blocks of text so that they appear as code, but it doesn't automatically indent the code for you and that's such a stylistic preference that it's unlikely to happen –  Daniel DiPaolo May 28 '11 at 8:47
    
I'm talking ab out actual formatting, like you have in IDE (eclipse, VS) or even paste-bin sites –  Yochai Timmer May 28 '11 at 8:48
    
Just do a test, ask a question, just declare a class, and function, press cntrl+k on it, and post .... there will b e no indentation –  Yochai Timmer May 28 '11 at 8:50
1  
@Yochai: Oh, so you're talking about automatic formatting of code? No, that's not been implemented yet, at least to my knowledge. However, if you're using Chrome, you could try the textarea formatter extension. For what it's worth, I'd prefer that the site not try and automatically format my code... –  Cody Gray May 28 '11 at 8:57
    
@Yochai it's indented, but that just causes the Markdown formatting to treat it as code, that 's it –  Daniel DiPaolo May 28 '11 at 8:58
    
Right, that's why I initially tagged this is a request. I'll change it to "formatting" instead of indenting so there won't be any more misunderstandings. –  Yochai Timmer May 28 '11 at 8:59
    
Fair enough, the retag was my mistake. Feel free to roll it back to "feature-request". But keep in mind, that in many languages, whitespace is significant. Automatic formatting like you mention would require a pretty robust syntax processor, and would probably cause as many problems as it solved. –  Cody Gray May 28 '11 at 9:00

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