Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Type Hinting Breaks Highlighting #234

@jdossgollin

Description

@jdossgollin

Prerequisites

Description

When using mypy-style type hinting in python, the syntax highlighting gets confused and no longer correctly identifies strings and keywords.
See:

screen shot 2018-02-09 at 10 18 00 am

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:

screen shot 2018-02-09 at 10 19 36 am

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions