-
Notifications
You must be signed in to change notification settings - Fork 146
Type Hinting Breaks Highlighting #234
Description
Prerequisites
- [ X ] Put an X between the brackets on this line if you have done all of the following:
- Reproduced the problem in Safe Mode: http://flight-manual.atom.io/hacking-atom/sections/debugging/#using-safe-mode
- Followed all applicable steps in the debugging guide: http://flight-manual.atom.io/hacking-atom/sections/debugging/
- Checked the FAQs on the message board for common solutions: https://discuss.atom.io/c/faq
- Checked that your issue isn't already filed: https://github.com/issues?utf8=✓&q=is%3Aissue+user%3Aatom
- Checked that there is not already an Atom package that provides the described functionality: https://atom.io/packages
Description
When using mypy
-style type hinting in python, the syntax highlighting gets confused and no longer correctly identifies strings and keywords.
See:
Steps to Reproduce
The following code was used to reproduce the above screenshot
"""An example of how highlighting with type hinting works
"""
def reg_fun(foo):
"""Syntax highlighting identifies strings
"""
bar = foo + 1
return bar
def my_fun(foo: float) -> None:
"""The syntax highlighting is now confused
"""
bar = foo + 2
return bar
def third_fun(foo):
"""The string is identified but the def word is wrong
"""
bar = foo + 3
return bar
Expected behavior: [What you expect to happen]
The highlighting should (best case) recognize the type hints, or (acceptable case) ignore them so that the highlighting works.
Actual behavior: [What actually happens]
When type hints are used, the type hinting no longer works.
It appears that the ->
is a key element of this; if I remove this, syntax highlighting works as expected:
Reproduces how often: [What percentage of the time does it reproduce?]
Always
Versions
You can get this information from copy and pasting the output of atom --version
and apm --version
from the command line. Also, please include the OS and what version of the OS you're running.
$ atom --version
Atom : 1.23.3
Electron: 1.6.15
Chrome : 56.0.2924.87
Node : 7.4.0
$ apm --version
apm 1.18.12
npm 3.10.10
node 6.9.5 x64
atom 1.23.3
python 3.6.4
git 2.16.1
Additional Information
Any additional information, configuration or data that might be necessary to reproduce the issue.