spyder: Fix issues with incorrect auto-indentation

From julian.h…@gmail.com on 2011-12-15T17:08:06Z

This is a enhancement/feature request.

Enhancement request:

1: def parseargs():
2:    ap = argparse.ArgumentParser()
3:    ap.description('Records results from standard HPC benchmarks and '+ \
4:        'corresponding information about the enviornment and input data to '+ \
5:        'interprete the results')
6:    ap.add_argument(...)

After hitting return on line 5, spyder autoindents with 8 spaces, thus requiring the user to hit backspace or shift-tab. This should be changed to: if the last line (where return was hit) completes a statement (in this case ap.description(…)), then autoindent to the indentation level of that statement, otherwise autoindent to previous line level.

Feature request:

1: if some.condition():
2:     do_one_thing()
3: else:
4:     do_another_thing()

After hitting return on line 2 spyder indents to 4 spaces, fine so fare. Here would it be nice to just type “else:” and have spyder do the unindentation by itself. The same behavior should be implemented for “except:” and “final:”. It makes sens to check if the user had already done the unindentation, to not confuse old users with this new behavior, for example by checking if a corresponding “if …:” or “try:” exists (this would fail with nested blocks) or by checking if backspace/shift-tab was hit just before typing the keyword.

_Original issue: http://code.google.com/p/spyderlib/issues/detail?id=887_

About this issue

  • Original URL
  • State: closed
  • Created 12 years ago
  • Comments: 30 (6 by maintainers)

Most upvoted comments