Surely an IDE as powerful as NetBeans isn't this clueless, but as I'm just typing out code, here is how it's formatting it:
$(document).ready(function() {
if (someVar > 2)
{
complain('that is not how you indent braces');
}
else if (someVar == -1)
complain('this is not right either!');
else
{
complain('but it did auto outdent the else which is smart');
complain('smart indeed');
}
});
How can I fix this so it formats as such:
$(document).ready(function() {
if (someVar > 2)
{
// this is how it's done
}
else if (someVar == -1)
// this is right
else
{
// correct
}
});
Code formatting was not an available feature in the earlier releases of NetBeans, but was added into the program with the release of NetBeans 7 (I believe). Try going to Tools -> Options -> Editor -> Formatting and see what options you have available, because that is where you would be able to add code formatting, if you could at all.
If that doesn't solve the issue, I would recommend doing the following (in no particular order).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With