MagicStack / MagicPython

Cutting edge Python syntax highlighter for Sublime Text, Atom and Visual Studio Code. Used by GitHub to highlight your Python code!
MIT License
1.41k stars 91 forks source link

support python 3.12 type alias syntax #265

Open DetachHead opened 7 months ago

DetachHead commented 7 months ago

python 3.12 introduced new syntax for type aliases:

type Foo = int

this is currently highlighted incorrectly:

image

(the type keyword should be blue and the Foo name should be green)

related: #262

DetachHead commented 7 months ago

as a workaround, i've fixed this with semantic highlighting in basedpyright:

image

though i'm not sure how to make it blue (or if it even should be blue). https://github.com/DetachHead/basedpyright/issues/147