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

PR: More autoindentation fixes #4082

Merged
merged 9 commits into from Feb 19, 2017
Merged

Conversation

rlaverde
Copy link
Member

@rlaverde rlaverde commented Jan 31, 2017

Fixes #4096
Fixes #4074

I fixed some issues reported applying hanging indent for long text only

a = {
     } #not hanging indent
some_long_name = {
              } #hanging indent (8 spaces)

@rlaverde rlaverde added this to the v3.2 milestone Jan 31, 2017
@rlaverde rlaverde self-assigned this Jan 31, 2017
self.textCursor().beginEditBlock()
TextEditBaseWidget.keyPressEvent(self, event)
self.fix_indent(comment_or_string=cmt_or_str)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem with deactivating this is that indentation would become active when you're working inside block comments. That's why I added this.

Instead we should be smarter and check if the line doesn't start with a comment and ends with it one to apply indentation in that case.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I see, then I'll add an extra check for detecting inline comments.

@ccordoba12 ccordoba12 modified the milestones: v3.2, v3.3 Feb 14, 2017
@rlaverde rlaverde changed the base branch from 3.x to 3.1.x February 16, 2017 15:37
@rlaverde rlaverde modified the milestones: v3.1.3, v3.2 Feb 16, 2017
@ccordoba12 ccordoba12 changed the title [WIP] Some indentation fixes More indentation fixes Feb 16, 2017
@rlaverde
Copy link
Member Author

rlaverde commented Feb 16, 2017

This is ready 😄

Should we open a new issue for simple indentation as mentioned in #4096? I think It could be an useful feature for some people, and also when working with non-python files

@rlaverde rlaverde closed this Feb 16, 2017
@rlaverde rlaverde reopened this Feb 16, 2017
@ccordoba12
Copy link
Member

Should we open a new issue for simple indentation ... ?

Yes, please do it, assign it to yourself and set it for 3.2.


Don't worry about the test failures. I'm working hard to make them more reliable (I'm almost there ;-)

@rlaverde rlaverde force-pushed the fix/indentation branch 2 times, most recently from be3dde4 to 01373f0 Compare February 17, 2017 20:14
@@ -1979,15 +1979,43 @@ def fix_indent(self, forward=True, comment_or_string=False):
(prevtext.strip().startswith("return") and
len(re.split(r'\(|\{|\[', prevtext)) ==
len(re.split(r'\)|\}|\]', prevtext)))):
print("hola2")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this print

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙈

@ccordoba12 ccordoba12 changed the title More indentation fixes PR: More autoindentation fixes Feb 18, 2017
@ccordoba12
Copy link
Member

ccordoba12 commented Feb 19, 2017

Great work @rlaverde! This solves all autoindentation issues reported by our users in 3.1 :-)

I simply pushed a commit to add some comments and fix column width of some lines.

pytest.mark.xfail(
("foo = 1 # Comment open parenthesis (\n",
"foo = 1 # Comment open parenthesis (\n",
"test_comment_with parenthesis")),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we solve this one for 3.1.4?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean, it doesn't seem that hard to address :-)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, although this case of use is very rare, I was thinking address it in the rewrite for 3.2

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, even better :-)

@ccordoba12 ccordoba12 merged commit 2a74590 into spyder-ide:3.1.x Feb 19, 2017
ccordoba12 added a commit that referenced this pull request Feb 19, 2017
ccordoba12 added a commit that referenced this pull request Feb 19, 2017
@rlaverde rlaverde deleted the fix/indentation branch February 20, 2017 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants