2

If I type the following javascript in Netbeans...

if (foo) [enter] { [enter] dostuff();

I get:

if (foo)
    {
        dostuff();
    }

which is just silly. Is there any way to get the correct result:?

if (foo)
{
    dostuff();
}

Edit: Apparently this is a bug that was supposedly fixed years ago.

Timmmm
  • 88,195
  • 71
  • 364
  • 509
  • Don't know the answer, but here's a tip: if you like your opening brackets in the next line, never do that when returning an object from a function, or js will return undefined instead. See http://stackoverflow.com/questions/2846283/what-are-the-rules-for-javascripts-automatic-semicolon-insertion-asi – bfavaretto Mar 08 '13 at 13:17

2 Answers2

0

Try Ctrl + Shift + f it is for formatting code automatically by the IDE

Ram G Athreya
  • 4,892
  • 6
  • 25
  • 57
0

This is apparently an open bug with Javascript and NetBeans as of 4/2/2013: https://netbeans.org/bugzilla/show_bug.cgi?id=182420

Kevin Borders
  • 2,933
  • 27
  • 32