Community
Participate
Working Groups
In JavaScript editor, just type the following (it doesnt matter, if this is within a block, like a function, or plain) Would be cool, to have automatic indentation after manually wrapping code in a control structure (e.g. if-block or any loop), which is a well-known feature from other IDE's. Here is how I imagine this feature: 1. Create some statements int n = 10; String foo = "bar"; 2. Realize, you need to wrap it with an if-block: if (canDo == true) { int n = 10; String foo = "bar"; 3. Mark the end, by adding the closing curly brace: } if (canDo == true) { int n = 10; String foo = "bar"; } // putting this here, should indent the block between the curly braces Expected result: if (canDo == true) { int n = 10; String foo = "bar"; } Actual result: if (canDo == true) { int n = 10; String foo = "bar"; } Or make this feature available with a preference setting.
Not exactly what you asked for, but you could enable 'Save Actions' and then have the formatter format all touched lines on save.
Hello Dani, not exactly what I meant, because this needs me to trigger the formatter. However, it's also not about the formatter, as the formatter takes the whole document into account. It's more similar to the auto-indentation after writing a method-signature, typing the open curly brace and hit enter. What's happening then is the next line is indented by <one> and the cursor is put there and in the next line, one indentation back is the closing curly brace. So, what I meant is if you have a chunk of code and you realize you want to wrap it in e.g. an if statement. So you write the if statement where you want to insert it, with the opening curly brace. Then move the cursor down, into the line where you want to place the closing curly brace. Ok, so once you typed it, all the between the opening and closing curly is automatically indented by <one>. Does this explanation help? Is it clear now?
(In reply to comment #2) > Hello Dani, > > not exactly what I meant, ... Right, that's why I said in comment 1: * Not exactly what you asked for * > Does this explanation help? Is it clear now? I never mention that it is not clear. That's why the bug got accepted and marked as ASSIGNED ;-).