- Notifications
You must be signed in to change notification settings - Fork 106
Add support for Python 3.6 f-string literal, underscore in numbers, and Python 3.5 type annotations#60
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
base:master
Are you sure you want to change the base?
Uh oh!
There was an error while loading. Please reload this page.
Conversation
achimnol commented Nov 25, 2016 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
More specifically, they are "built-in constants": https://docs.python.org/2/library/constants.html#built-in-consts
* "_0" is a valid identifier!
lilydjwg commented Dec 9, 2016
It works great for me, thank you! |
monkoose commented Dec 31, 2016 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
Seems like @hdima is rare guest on github lately. But this is the best known vim python syntax repository. |
lilydjwg commented Dec 31, 2016
That will need privileges granted by hdima, or we can only have forks. I'm already maintaining my own fork. |
mostly taken from hdima/python-syntax#60
* Make them highlighted only when used as in the global namespace. (e.g., `id` in `something.id` is not highlighted) * Also add self and cls to builtin objects
* Builtin-functions are highlighted only when used as global functions. * Annotations in type-only variable definitions and assignment statements are not supported yet due to potential conflicts with dictionary expressions. * Uses a custom syntax highlight def "Optional" (in my setup, it applies italic style.) * Taken from purpleP/python-syntax commits and customized.
* It is recommended to override it in colorschemes.
y9c commented Mar 15, 2018
Thanks you for you work. I seems that *red arrow indicate the code that should not mark as python type annotation. * |
y9c left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wsdjeg commented Mar 16, 2018
as I know Vim runtime has python syntax file. so what is the differences? and why is can not be merged into Vim core repo? |
lilydjwg commented Mar 19, 2018
@achimnol @yech1990 don't include |
| syn match pythonStatement "\<async\s\+for\>" display | ||
| endif | ||
| syn cluster pythonTypeExpression contains=pythonTypeAnno,pythonTypeUnion,pythonTypeArgs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove pythonTypeArgs ?
y9c commented Mar 19, 2018
@lilydjwg Thank you for your reply. I remove |
lilydjwg commented Mar 23, 2018 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
@yech1990 No. I was using another version. I've switched to this version since it has more features. I'll comment here if I notice anything wrong. |
lilydjwg commented Apr 28, 2018
@yech1990 here's another bug: deffunc(): a=call(x|y)
|


PR for #58 and #59.
Finally I figured out how to "embed" other syntax inside a region using
syn cluster.Python keywords, numbers, booleans, and builtins are highlighted inside f-string braced regions.
I tried to prevent the content inside braces from being highlighted as "Special" while keeping the braces and format string highlighted, but could not separate them. Still, I think this version much improves readability.
Comments, optimizations, and fixes are welcome.