Open minmax opened 7 months ago
@minmax not fully following. why did you give "OldName" to Annotated
rather than actually type OldName
?
basically, why Annotated["OldName", ...]
rather than Annotated[OldName, ...]
?
with proper input, rename should work as expected.
It's legal syntax and would be required in a forward-ref scenario, but rename doesn't properly handle it there. Similarly, go to def doesn't work on OldName
and it's not colored properly as a type.
class C:
y: Annotated["OldName", "annotation"]
class OldName:
pass
Interestingly, it works with ClassVar
though:
class C:
y: ClassVar["OldName"]
class OldName:
pass
I see so, the asking is make first argument of Annotated
as one of place where we recognize string as type like a: "int"
or ClassVar["str"]
or # type: "myType"
?
sounds reasonable.
make first argument of
Annotated
as one of place where we recognize string as type
yes, that's what I was trying to say
After rename OldName -> NewName, pylance does not update Annotated.
Pylance language server 2024.2.105 (pyright version 1.1.351).