I'm using Eclipse to edit JavaScript files and I guess I'm "doing it wrong". Given the following code, where »
represents a tab,·
represents a space, and |
represents the cursor:
function·foo()·{
» var·baz·=·[|
}
If I hit enter at this point, I get
function·foo()·{
» var·baz·=·[
» ···········|
}
Yuck. I would much rather get
function·foo()·{
» var·baz·=·[
» » |
}
I've dug through the various "Typing" and "Formatter" preferences to no success. Did I overlook something? Or is there a particular incantation that I must chant or spell I can cast on Eclipse, to make it behave this way? Thanks.
Indeed a (bug|weird feature|annoyance) of the Eclipse Javascript editor.
The quickest hack way I found to overcome this is to quickly insert an empty js object and hit the Format shortcut and let the Eclipse javascript editor to sort out the tabs:
function·foo()·{var·baz·=·[{}]}
hit format:
function·foo()·{
» var·baz·=·[
» » {}
» ]
}
This also works for an empty string with double / single quotes instead of an empty object.
Note: The Aptana v2 js editor works fine.
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