MagicPython icon indicating copy to clipboard operation
MagicPython copied to clipboard

Support for PEP 695 (Type parameters / generics)

Open Badg opened this issue 1 year ago • 1 comments
trafficstars

Related to #229: when writing a generic class/function that uses type parameters, the syntax is incorrectly highlighted. This syntax was introduced in 3.12 via PEP 695.

Currently these are incorrectly scoped as attribute access (see attached screenshots). MVP to reproduce is simply

class Foo[T]:
  pass
  • Editor name and version: Sublime text 4169
  • Platform: Windows 10
  • Color scheme: Monokai
  • MagicPython version: 1.1.1

2024-01-15-magicpython_pep_695 2024-01-15-magicpython_pep_695_scope 2024-01-15-magicpython_pep_695_scope_2

Badg avatar Jan 15 '24 22:01 Badg

I took a hacky stab at this in #270

asottile avatar Mar 12 '25 02:03 asottile