question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Fix issues with incorrect auto-indentation

See original GitHub issue

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_

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:30 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
blink1073commented, Jul 12, 2016

magic

0reactions
CAM-Gerlachcommented, Feb 18, 2018

Just for reference, my #5606 is a partial duplicate of this, though up to date with the latest version and even more extensive. Setting it to track the same milestone for now…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Incorrect auto indent YAML files · Issue #43424 - GitHub
It behaves as disabled when no rules are defined. IMO the correct fix is to turn off indent on paste for YAML. Indentation...
Read more >
Eclipse auto-indent incorrectly indents file - java - Stack Overflow
1 Answer 1 ... I was able to reproduce the issue. ... You can also attempt to format the code (Ctrl + Shift...
Read more >
Incorrect auto-indent bash - Vi and Vim Stack Exchange
1 Answer 1 · In the original post, I had been setting "filetype indent on" through the command prompt in vim... which wasnt...
Read more >
Wrong indenting - Visual Studio Feedback
For the issue "VC is using both tabs and spaces to indent a single line" may be because the Tab size is different...
Read more >
Auto-indent lines feature wrongly indents multiline chained ...
This issue makes the auto-formatting feature for Python useless. @Mikhail Golubev , are there any plans to fix this issue?
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found