How to write a PyCharm extension to convert an unsupported type?

I noticed PyCharm doesn't yet have proper support for `typing_extensions`, specifically `Final` type. For example, I have code that returns `Final[Foo]`. The problem is autocompletion is broken on such an instance variable, where it doesn't know to prompt fields for `Foo`.

I want to write an extension to process all `Final[Foo]` into `Foo`. Is this possible?

 

Example code to repro:

 

#!/usr/bin/env python3

from typing_extensions import Final

class Foo:
x: int
y: str


foo: Foo = None
foo.x # autocomplete works


foo2: Final[Foo] = None
# autocomplete does NOT work:
foo2.x


3 comments
Comment actions Permalink

Could you provide code example to reproduce the issue?

0
Comment actions Permalink

Hi Andrey, example is provided in the updated post above.

0
Comment actions Permalink

It seems the issue does not reproduce in PyCharm 2019.3.3:

What version are you using? Does it reproduce in the latest? 

https://www.jetbrains.com/pycharm/download

0

Please sign in to leave a comment.