Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show variable hints for generic types when the argument isn't a literal #6915

Open
luabud opened this issue Feb 3, 2025 · 0 comments
Open
Assignees
Labels
needs repro Issue has not been reproduced yet

Comments

@luabud
Copy link
Member

luabud commented Feb 3, 2025

Type: Bug

Enable inlay variable type hints. Then have this sample code:

from pydantic import BaseModel

class Item(BaseModel):
    item_id: int
    item_name: str

my_items = {
    0: Item(item_id=41230, item_name="item_0"),
    1: Item(item_id=142131, item_name="item_1"),
}

my_items_keys= list(my_items.keys())

I was expecting a list[int] hint on the last line, since it may not be obvious what the argument evaluates to.

Extension version: 2025.1.102
VS Code version: Code - Insiders 1.97.0-insider (0fb834cd250880f4fb801a7771827a1ea23e4cdb, 2025-01-31T21:47:31.048Z)
OS version: Windows_NT x64 10.0.26100
Modes:

Extension version: 2025.1.102
VS Code version: Code - Insiders 1.97.0-insider (0fb834cd250880f4fb801a7771827a1ea23e4cdb, 2025-01-31T21:47:31.048Z)
OS version: Windows_NT x64 10.0.26100
Modes:

System Info
Item Value
CPUs 11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz (8 x 2995)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) undefined
Memory (System) 31.71GB (13.11GB free)
Process Argv --log trace --log ms-python.autopep8=debug --crash-reporter-id 11494669-52ca-4f2c-aa0e-29172189cc8e
Screen Reader no
VM 0%
A/B Experiments
vsliv368cf:30146710
vspor879:30202332
vspor708:30202333
vspor363:30204092
vsc_aa:30263845
vscod805:30301674
vsaa593:30376534
py29gd2263:31024238
c4g48928:30535728
2i9eh265:30646982
962ge761:30841072
pythonnoceb:30776497
dsvsc014:30777825
dsvsc015:30821418
pythonmypyd1:30859725
h48ei257:31000450
pythontbext0:30879054
cppperfnew:30980852
pythonait:30973460
dwnewjupyter:31046869
nativerepl1:31134653
pythonrstrctxt:31093868
nativeloc1:31118317
e80f6927:31120813
iacca1:31150324
notype1:31143044
dwcopilot:31158714
h409b430:31177054
c3hdf307:31184662
6074i472:31201624
dwoutputs:31217127
9064b325:31222308
copilot_t_ci:31222730
f27dg485:31230452

@github-actions github-actions bot added the needs repro Issue has not been reproduced yet label Feb 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs repro Issue has not been reproduced yet
Projects
None yet
Development

No branches or pull requests

2 participants