Skip to content

Python 3 Type Annotations #221

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

Closed
LittleFire000000000 opened this issue Mar 1, 2016 · 10 comments
Closed

Python 3 Type Annotations #221

LittleFire000000000 opened this issue Mar 1, 2016 · 10 comments
Labels
T: bug A bug in an existing language feature

Comments

@LittleFire000000000
Copy link

Type annotations from Python3 are troubling Sublime (Stable Channel, Build 3103)'s Python docstring syntax-highlighting. No plugins are present in my default Windows 7 64bit Sublime installation.
capture

@wbond
Copy link
Member

wbond commented Mar 1, 2016

Can you paste the actual code here?

@MattDMo
Copy link
Contributor

MattDMo commented Mar 1, 2016

The Python Improved language syntax already fully supports type annotations, if you'd like to try it out.

@wbond wbond changed the title Bug report Python 3 Type Annotations Mar 1, 2016
@FichteFoll
Copy link
Collaborator

Relevant: https://www.python.org/dev/peps/pep-3107/

I would suggest properly separating the python lexer into expressions and statements, which makes arbitrary function annotations (and default values too?) easier to handle, probably. It's what I wanted to do for quite a while anyway.

@MattDMo
Copy link
Contributor

MattDMo commented Mar 2, 2016

@FichteFoll on this repo, or Python Improved? I've started a sublime-syntax branch, and I'm open to a rewrite/reorg if you're interested.

@FichteFoll
Copy link
Collaborator

In general.

I would rather patch/replace the shipped Python instead of iterating on Python Improved.

@wbond
Copy link
Member

wbond commented Mar 2, 2016

I just left a comment on #51 (comment).

In short, I greatly appreciate all of the work that went into Python Improved, but I'm not currently comfortable merging in a big change like that. I'd rather see small, focused issues/PRs and move forward that way. It is easier for me to review and/or implement in small chunks. I think it will also be easier for others to help review. It also reduces the chances of changes drastically affecting the syntax highlighting of Python, such as what happened with JavaScript in build 3103.

@MattDMo
Copy link
Contributor

MattDMo commented Mar 2, 2016

@wbond I agree - I definitely wouldn't want to do a wholesale replacement of the original for PI, as PI still has some issues to be worked out and features to be added. I'll keep working on PI in my spare time to add new features like str.format() highlighting and f-strings for Python 3.6. However, I'll also start issuing some small PRs for this repo, perhaps for necessary Python 3 stuff like function annotations and coroutines, then working backwards to clean up magic names and functions, properly classifying builtins and whatnot, adding full Unicode support, and whatever else comes along.

For speed testing, do you have any favorite files in the stdlib that are really large? I have some smaller files for use with scope testing QA, but it'd be nice to have a good large file for benchmarking. Preferably something that's not 80% docstrings 😀

@wbond wbond added the T: bug A bug in an existing language feature label Apr 28, 2016
@MattDMo
Copy link
Contributor

MattDMo commented Apr 29, 2016

@wbond how "nailed-down" is the new Python.sublime-syntax? Meaning, can I start working on it to add support for type annotations and not have to worry about major parts changing under me? Also, do you and Jon have an approximate release date for 3112? I ask because if you're planning on releasing the reworked Python syntax with 3112, I'd like to work on my color scheme to support it.

@wbond
Copy link
Member

wbond commented Apr 29, 2016

@MattDMo I've been working on Python heavily today and will likely have annotations done by the end of the day, plus most likely async/await.

In general the scopes are not being changed much, I'm trying to bring all of the syntaxes in line with the commonly-used scopes out there.

There will likely be some meta scope changes, but generally those shouldn't affect color schemes much. They are more useful for detecting symbols and controlling the indexer.

I do not know when 3112 will come out. Jon deals with releases and scheduling them.

@wbond
Copy link
Member

wbond commented Apr 29, 2016

This has been added in 830956c. Please open a new issue if you find any bugs with it.

@wbond wbond closed this as completed Apr 29, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T: bug A bug in an existing language feature
Projects
None yet
Development

No branches or pull requests

4 participants