Sublime Forum

Unrecognized Python 3 code in syntax highlighting

#1

This holds for both version 1.4 & 2.

When a python code has annotation for a function’s return type,
the syntax highlighting of the following code is all broken.

For example:

def foo( value: int ) -> int:
    return value + 2
# all syntax highlighting broken below this line
...
0 Likes

#2

This still seems to be the case… :’(

0 Likes

#3

I just registered and was about to make a post about it.

I find this really annoying. Hope they will fix it soon!

0 Likes

#4

2 years have passed. Any news on this issue?

0 Likes

#5

Here’s a wrinkle. In ST3, If I do this, syntax highlighting is only broken for the next function header. After that it works correctly. The part of the syntax that is causing problems is the -> int. Hopefully that will give some hints as to what in the highlighting engine is breaking.

0 Likes

#6

I’d recommend using another python syntax file. Such as github.com/facelessuser/sublime … tmLanguage

0 Likes