SlickEdit Product Discussion > Features and/or Improvements

Python editing / indenting

(1/1)

jporkkahtc:
When editing Python Slickedit likes to indent too much.
For functions at least, I can always include an empty return or pass statement, but for blocks inside of a function that doesn't work as well.

#1 I'd like to have an option to outdent when I enter a blank line inside of a block. (its arguable if that means 1 or 2 blank lines I suppose).
#2 Python should automatically outdent for nested def or class. Sure, the language allows these to be nested, but it is far more common not to do so.


For example, given this:

--- Code: ---def one():
    print("Hey")


--- End code ---
if I select that and then paste it at the end, I get:

--- Code: ---def one():
    print("Hey")

    def one():
        print("Hey")

--- End code ---
Which is almost never the right thing to do.

Same thing while typing, it only outdents after certain words (return, raise, etc)
It might be nice while typing (not beautifying!) that an extra blank line will outdent.
Then if I type this (without manually outdenting for "two"):

--- Code: ---def one():
    print("Hey")

    def two():
        print("there")

--- End code ---
Instead I would get

--- Code: ---def one():
    print("Hey")

def two():
    print("there")

--- End code ---


Inside of a function, with if statements, currently I get this:

--- Code: ---    if is_true:
        print("True")

        if is_false:
            print("False"):

--- End code ---
But, I would like to get this (without manually outdenting for the 2nd if):

--- Code: ---    if is_true:
        print("True")

    if is_false:
        print("False"):

--- End code ---


Not having block delimiters was supposed to make Python simpler, but in reality it just complicates things!

JeffB:
+1 for this. I never narrowed down exactly what makes slickedit decide when or not to indent, but it's wrong (for me) about 90% of the time.  "undo" helps sometimes to just re-unindent, but pasting Python code in slickedit is a pain :(

Navigation

[0] Message Index

Go to full version