Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Indentation issue using Tabs #3508

Closed
airdrik opened this issue Oct 6, 2016 · 4 comments
Closed

Indentation issue using Tabs #3508

airdrik opened this issue Oct 6, 2016 · 4 comments

Comments

@airdrik
Copy link

airdrik commented Oct 6, 2016

Description of your problem

Using tabs for indentation, when indenting a new line in the middle of a statement (e.g. between parentheses/braces/brackets), it inserts more tabs than expected (looks like current indentation + 5), and there is no way to configure it.
What steps will reproduce the problem?

  1. Set up the editor to use Tabulations for indentation
  2. in the editor, type a = {}
  3. with the cursor between the braces hit enter

What is the expected output? What do you see instead?
expected: the new line is indented with 1 (or 2; configurable) tabs
actual: the new line is indented with 5 tabs

Please provide any additional information below
Hitting tab after removing any/all indentation immediately adds back to the original number of tabs.
Even if the first line in the continuation block (additional lines associated with a single statement) is indented the way I expect, subsequent lines still start with the original number of tabs rather than aligning with the previous line. This is the most obnoxious part of this issue as that means I have to manually correct each line of a continuation block.

Suggested behavior:
Continuation lines should indent with one more unit of indentation than the parent of that continuation block. Subsequent lines should indent with the same indentation as the previous line. Continuation blocks may be nested (e.g. if calling a function with many parameters, where one parameter is another function call with many parameters and I want to have each parameter on its own line, or if defining a nested json-like structure of dicts and lists), in which case each new nesting would increase the indentation by one unit of indentation.

It would be nice if the continuation indentation were configurable as well, as some users may prefer 2 indents instead of 1.

Versions and main components

  • Spyder Version: 3.0.0
  • Python Version: 3.4.3
  • Operating system: Ubuntu 14.04
  • Qt and PyQt Version: 5.2.1

Dependencies

Please go to the menu entry Help > Optional Dependencies (or
Help > Dependencies), press the button Copy to clipboard
and paste the contents below:

I don't see a menu.
I installed it using pip.

@airdrik
Copy link
Author

airdrik commented Oct 6, 2016

Wait, I lied a bit. Subsequent lines in a continuation do behave as expected, carrying over the previous line's indentation. I think I may have been triggering the new continuation line multiple times over (like where it tries to be smart about where a new line should start after several blank lines and/or comment-only lines)

@airdrik
Copy link
Author

airdrik commented Nov 1, 2016

The original case in the steps to reproduce is still a problem (tested again with spyder 3.0.1). My previous comment was only that subsequent lines behave as expected.

@ccordoba12 ccordoba12 reopened this Nov 1, 2016
@ccordoba12 ccordoba12 added this to the v3.1 milestone Nov 1, 2016
@ccordoba12
Copy link
Member

@rlaverde, please take a look at this one.

@airdrik
Copy link
Author

airdrik commented Nov 1, 2016

Additional information in some testing just now:
If the opening brace/bracket/paren is on its own line and a new line is added after it, the new line adds 1 more tab as expected. If there is other stuff before the brace/bracket/paren then it adds the extra tabs (looks like one for each non-indentation character before the bracket).

I suppose there could be some who prefer that behavior with spaces to help align the next lines with the opening brace, but with tabs that just doesn't work very well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants