In Emacs, the amount of indentation to place after a hanging open-paren (or open-brace or open-bracket) is context-sensitive. In the case where nothing follows the bracket on the line it appears, the effect is to add one additional indent. In the case where something does follow, the effect is to line up subsequent lines to indent matching the bracket. For example (assuming a monospaced font):
hello_world(a, b, c,
d, e, f)
vs.
hello_world(
a, b, c,
d, e, f
)
This style of indentation is preferable because in a codebase where one is supposed to keep lines less than 80 characters, it allows for breaking of long lines on a parenthesis or bracket, but keeps them lined up if the thing before the parenthesis is short. Two longer examples to show why this is helpful:
system.componentRegistry().getSystemComponent(IComponentFactory).create(
MyComponent, system.componentRegistry()
)
combine(alpha.beta.gamma.delta.epsilon.zeta.eta.theta.iota.kappa,
omega.psi.chi.phi.upsilon.tau.sigma.rho.pi.omicron,
1, 2, 3, 4, 5)
It would be nice if PyDev could support this style of auto-indentation in addition to the modes that it has now.
Note that in the current preferences, you can already choose to add only 1 indent level instead of going to the '(' level -- it's the second preference on window > preferences > pydev > editor > typing.
I'm not sure I followed your thoughts, let me see:
if you have:
hello(a,b,c,d,e,f), and you pressed enter after the 'c', you'd like to go to the 1st example, yet, if you pressed it after the '(', you'd go to the second example?
The same examples with dots:
hello_world(a,.b,.c,
............d,.e,.f)
hello_world(
....a,.b,.c,
....d,.e,.f
)
system.componentRegistry().getSystemComponent(IComponentFactory).create(
....MyComponent,.system.componentRegistry()
)
combine(alpha.beta.gamma.delta.epsilon.zeta.eta.theta.iota.kappa,
........omega.psi.chi.phi.upsilon.tau.sigma.rho.pi.omicron,.
........1,.2,.3,.4,.5)
Yes, you've followed my example correctly.
I'm aware of the preference, but sometimes I want one behavior and sometimes the other, so no matter which one I choose I end up either adding or deleting lots of spaces :).
Thanks.