-
Notifications
You must be signed in to change notification settings - Fork 1k
Support for **kwargs autocompletion when using Unpack[T] #2541
Description
Environment: Pylance version v2022.3.4, from vscode.
I'm not sure if it is a bug or would be considered a new feature. I understood from microsoft/pyright#3002 that typed **kwargs are now supported by pylance/pyright. Thank you for this!
Now when I try the example mentioned at microsoft/pyright#3002 (comment) I see that while type checking seem to work correctly, the autocompletion doesn't seem to work as I would expect.
Let's say I have this code in vscode, with Pylance enabled:
from typing_extensions import Unpack, TypedDict, Literal
class MyKwargs(TypedDict):
foo: Literal["hello", "nopnop"]
bar: int
def baz(**kwargs: Unpack[MyKwargs]) -> None:
pass
baz(foo="hello", bar=3)
baz(|) # 👈 My caret is hereI would expect that when I trigger the autocompletion via ctrl+space I would get suggested foo= and bar=, but instead the only relevant suggestion is kwargs=.
When I trigger the autocompletion for MyKwargs() arguments I get something correct, the issue seem to only be when using Unpack[T]:

It would be nice to have the list of keys of the unpacked typed dict :)
