GNOME Bugzilla – Bug 742921
Python auto-indentation oddity
Last modified: 2015-01-20 04:33:38 UTC
I found a weird problem with the python auto-indentation in Builder. Assume this sample code: def foo(): ret = "foo".format(bar,len(baz)) If you press enter after the closing ) of the .format, the next line will begin on column 24 instead of in column 5 like it should.
I broke this a little bit recently :( I want to refactor the python auto indenter. Like most auto indenters, it grew into a crazy set of rules pretty fast. Not my finest hour. I think we need to break it out into a couple of stages. One to determine the mode we are in, and another stage to perform the indentation based on that understanding. It might be worth while to sit down and work through what those steps would be. For example, what is the logical order that we need to follow for indenting? What takes precedence?
Created attachment 294941 [details] [review] python: fix indent after function call statement This fixes indent after something like: "foo".format(bar, len(baz))
Attachment 294941 [details] pushed as 2773c17 - python: fix indent after function call statement