I love ST2, but really miss the way Emacs handles the formatting of line continuations in Python. It adheres very closely to PEP 8 (see the section on “Code lay-out”). For example, here’s the result of entering code with line continuations in Emacs. I’ve done no formatting at all - this is just how Emacs indents stuff:
class Foo(object):
def foo(self,
arg1, arg2,
arg3,
arg4):
if self.method() \
.method2() \
.method3():
pass
Here’s the same code entered in ST2. Note how in each line continuation, the second and following lines are indented at the same level as their parent lines and aren’t visually distinguishable.
class Foo(object):
def foo(self,
arg1, arg2,
arg3,
arg4):
if self.method() \
.method2() \
.method3():
pass
Much more important than devotion to a style guide is that code following those continued lines - such as the “if self.method …]” and “pass” lines in my example - should be indented to form new blocks, but ST2 doesn’t indent them at all. The result is syntactically invalid Python.
I haven’t worked up the bravery to investigate the syntax definitions myself. Is it possible to implement this idea in ST2 as it stands today?