jedi icon indicating copy to clipboard operation
jedi copied to clipboard

[FeatureRequest] `F2` rename import typing, should result changes in function annotations

Open loynoir opened this issue 2 years ago • 2 comments

Actual

Change type from pre to post

Pre:

if typing.TYPE_CHECKING:
    from custom_types import pre

def parse_args() -> 'pre':
    return foobar

Post:

Error: Name "pre" is not defined

if typing.TYPE_CHECKING:
    from custom_types import post

def parse_args() -> 'pre':
    return foobar

Expected

Change type from pre to post

Pre:

if typing.TYPE_CHECKING:
    from custom_types import pre

def parse_args() -> 'pre':
    return foobar

Post:

if typing.TYPE_CHECKING:
    from custom_types import post

def parse_args() -> 'post':
    return foobar

loynoir avatar Jan 27 '22 17:01 loynoir

https://github.com/microsoft/vscode-python/issues/18366

loynoir avatar Jan 27 '22 17:01 loynoir

I'm quite confident that this is not going to get fixed, because it just does not have a high priority. But I'm very happy to accept pull requests. In the meantime I can recommend using from __future__ import annotations and not using string literals as annotations.

davidhalter avatar Jul 26 '23 22:07 davidhalter