Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Remove patterns for decreasing next indent level - #212

Merged
winstliu merged 1 commit into
masterfrom
wl-revert-decrease-next-indent
Oct 17, 2017
Merged

winstliu merged 1 commit into
masterfrom
wl-revert-decrease-next-indent

Conversation

@winstliu

@winstliu winstliu commented Oct 17, 2017 •

Copy link
Copy Markdown
Contributor

This PR reverts the functional changes of #204. Unfortunately, there is no way (yet) to tell if we're in an if block, which can lead to multiple dedenting in the following scenario:

  if True:
    # something
    return
  # we are now at this indent level because of `decreaseNextIndentPattern`
else: # but typing `else:` will trigger another dedent from `decreaseIndentPattern`

I would argue that that is worse than having to shift-tab after a return that is not in an if statement.

/cc @kbrose

Fixes #209

@winstliu
winstliu merged commit 98547ff into master Oct 17, 2017
@winstliu
winstliu deleted the wl-revert-decrease-next-indent branch October 17, 2017 19:53
@kbrose

kbrose commented Oct 17, 2017

Copy link
Copy Markdown
Contributor

... no discussion?

@winstliu

Copy link
Copy Markdown
Contributor Author

Sorry, this was more of a temporary fix. I'm open to discussion, I just wanted to revert it back to where we originally were so that it wouldn't seem like there was any time pressure.

@kbrose

kbrose commented Oct 17, 2017 •

Copy link
Copy Markdown
Contributor

Ok, well as you can imagine I'm a -1 on this. Both versions give you incorrect indentation, the difference is the old-old version (that this reverts to) is incorrect on every end-of-block-like statements (i.e. return), whereas the old (before this revert) version has incorrect indentation in only some instances of those statements.

@winstliu

Copy link
Copy Markdown
Contributor Author

Yeah. However, and maybe this is personal taste, I feel that having the indentation consistently not change is somewhat more expected than having the indentation unexpectedly change. For the former I can get used to shift-tabbing after every end statement, whereas for the latter there's more muscle memory involved, as well as some cursor movement (as shift-tab will work anywhere, but tabbing will only work at the beginning of the line).

@kbrose

kbrose commented Oct 17, 2017

Copy link
Copy Markdown
Contributor

No mouse touching needed - if you have at least one character highlighted tab will work as expected, so I trained a shift left-arrow tab (highlight one character to the left of the cursor and indent) muscle memory for myself.

@kbrose

kbrose commented Oct 18, 2017

Copy link
Copy Markdown
Contributor

Did the tests run on this PR? I ran tests locally against master branch and had some failures. I had to update the spec file as seen in 7f8ea3b

@winstliu

Copy link
Copy Markdown
Contributor Author

See my review comment in #214 - I'm not sure why but atom.workspace.open doesn't always work anymore on CI. Removing the filename fixes the issue (see atom/language-go@ca11612). I need to file an issue for that.

DSpeckhals added a commit to DSpeckhals/python-indent that referenced this pull request Nov 9, 2017
This pattern was recently removed from language-python.
See atom/language-python#212

This commit handles that scenario, as well as fixes tests surrounding
it. Other tests were adjusted to handle Atom not auto-inserting the
indentation for several scenarios where we are currently using the
`makeNewline` function. The tabs to indent (which are always a multiple
of the editor's tab length) can be passed. This only happens on Atom >
1.23. There is probably a better solution for this in the long term.
DSpeckhals added a commit to DSpeckhals/python-indent that referenced this pull request Nov 9, 2017
This pattern was recently removed from language-python.
See atom/language-python#212

This commit handles that scenario, as well as fixes tests surrounding
it. Other tests were adjusted to handle Atom not auto-inserting the
indentation for several scenarios where we are currently using the
`makeNewline` function. The tabs to indent (which are always a multiple
of the editor's tab length) can be passed. This only happens on Atom >
1.23. There is probably a better solution for this in the long term.
DSpeckhals added a commit to DSpeckhals/python-indent that referenced this pull request Nov 9, 2017
This pattern was recently removed from language-python.
See atom/language-python#212

This commit handles that scenario, as well as fixes tests surrounding
it. Other tests were adjusted to handle Atom not auto-inserting the
indentation for several scenarios where we are currently using the
`makeNewline` function. The tabs to indent (which are always a multiple
of the editor's tab length) can be passed. This only happens on Atom >
1.23. There is probably a better solution for this in the long term.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants