pappasam / jedi-language-server

A Python language server exclusively for Jedi. If Jedi supports it well, this language server should too.
MIT License
596 stars 45 forks source link

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

Closed loynoir closed 2 years ago

loynoir commented 2 years ago

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 commented 2 years ago

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

pappasam commented 2 years ago

@loynoir this appears to be an issue where string annotations are not recognized by Jedi. If you remove the quotes around pre, things should work as expected.

Since all this logic is handled by Jedi, we should consider this a Jedi issue and file this issue upstream here: https://github.com/davidhalter/jedi