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

[py] indentation (and highlighting) not working well with type-annotated python #75

Open
mtaran-google opened this issue Oct 27, 2017 · 2 comments

Comments

@mtaran-google
Copy link
Contributor

see https://www.python.org/dev/peps/pep-0484/

import typing

class Example(object):

  def method(self, x: typing.List):
    self.x = x

pressing enter at the end of the last or second to last lines changes the indentation to 0, whereas it should indent to 4 in both cases.

Also the type annotation isn't highlighted as a type.

marijnh added a commit that referenced this issue Oct 29, 2017
@marijnh
Copy link
Member

marijnh commented Oct 29, 2017

Attached patch makes the grammar parse things in type position as normal expressions — since they are. Is that okay, or do you want some kind of custom highlighting for such expressions? (This'd require duplicating some stuff and introducing some irregularity in the way things are parsed, so I'm not sure it's a good idea.)

@mtaran-google
Copy link
Contributor Author

Will show it to users and see what they think :)

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

No branches or pull requests

2 participants