microsoft / pylance-release

Documentation and issues for Pylance
Creative Commons Attribution 4.0 International
1.72k stars 767 forks source link

Rename key in TypedDict using "rename symbol" refactor should update all instances of that TypedDict #5386

Open ldorigo opened 10 months ago

ldorigo commented 10 months ago

Type: Bug

Behaviour

Expected vs. Actual

If I create a TypedDict and reference one of its keys somewhere, I expect that key to change when I rename it in the TypedDict definition.

Steps to reproduce:

from typing import TypedDict

class Foo(TypedDict):
  bar: str

def myfunc(mydict: Foo):
  print(mydict["bar"])

In the above, if I do F2 (rename symbol) and rename bar to baz, I would expect mydict["bar"] to become mydict["baz"] - but currently that is not the case.

Diagnostic data

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

``` XXX ```

User Settings

``` venvPath: "" languageServer: "Pylance" linting • enabled: false • mypyPath: "" • prospectorArgs: "" formatting • provider: "black" testing • cwd: "" • pytestArgs: "" • pytestEnabled: true tensorBoard • logDirectory: "" ```

Extension version: 2023.14.0 VS Code version: Cursor 0.22.2 (ecfbaf72d176819d122080bc0b8bcd76cc586e10, 2024-01-17T07:56:48.316Z) OS version: Linux x64 6.1.71-1-lts Modes:

System Info |Item|Value| |---|---| |CPUs|AMD Ryzen 7 3700X 8-Core Processor (16 x 4148)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: disabled_off
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
video_decode: enabled
video_encode: disabled_software
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off| |Load (avg)|2, 2, 2| |Memory (System)|31.29GB (6.87GB free)| |Process Argv|--no-sandbox| |Screen Reader|no| |VM|0%| |DESKTOP_SESSION|plasma-i3| |XDG_CURRENT_DESKTOP|KDE| |XDG_SESSION_DESKTOP|KDE-i3| |XDG_SESSION_TYPE|x11|
debonte commented 10 months ago

@KacieKK, does this fit in with the other TypedDict issues you're working on?