microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.59k stars 29.03k forks source link

Renaming a string property without space to a string property with spaces doesn't rename them elsewhere #170131

Closed sebastienlabine closed 1 year ago

sebastienlabine commented 1 year ago

Type: Bug

Let's say I have a typescript class with a property name "Type";

export class Product{
    public "Type": string = "";
}

and I use it like this

let product: Product  = {
      Type: "test"
}
let productType = product.Type;

and using the F2 rename assistant, I rename it to "Product Type".

My usage of the variable will not be property updated.

I expect

let productType = product["Product Type"];

but instead I receive:

let productType = product.Product Type;

causing compilation error

VS Code version: Code 1.74.2 (e8a3071ea4344d9d48ef8a4df2c097372b0c5161, 2022-12-20T10:29:14.590Z) OS version: Windows_NT x64 10.0.19044 Modes: Sandboxed: No

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz (8 x 2304)| |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
skia_renderer: enabled_on
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off| |Load (avg)|undefined| |Memory (System)|15.79GB (5.53GB free)| |Process Argv|--crash-reporter-id 0e3981cf-ae9d-49a9-8309-186af074bf93| |Screen Reader|no| |VM|0%|
Extensions (25) Extension|Author (truncated)|Version ---|---|--- aws-toolkit-vscode|ama|1.60.0 vscode-tailwindcss|bra|0.9.1 vscode-expo|byC|0.9.2 vscode-eslint|dba|2.2.6 solidity|Jua|0.0.141 vscode-mjml|mjm|1.0.5 vscode-docker|ms-|1.23.3 vscode-language-pack-fr|MS-|1.74.12140928 csharp|ms-|1.25.2 isort|ms-|2022.8.0 python|ms-|2022.20.1 vscode-pylance|ms-|2022.12.20 jupyter|ms-|2022.11.1003412109 jupyter-keymap|ms-|1.0.0 jupyter-renderers|ms-|1.0.12 vscode-jupyter-cell-tags|ms-|0.1.6 vscode-jupyter-slideshow|ms-|0.1.5 remote-containers|ms-|0.266.1 remote-wsl|ms-|0.72.0 vscode-commons|red|0.0.6 vscode-xml|red|0.23.0 vscode-yaml|red|1.10.1 vscode-scss-formatter|sib|2.4.4 vscode-mdx|uni|1.0.3 markdown-all-in-one|yzh|3.5.0
A/B Experiments ``` vsliv368:30146709 vsreu685:30147344 python383:30185418 vspor879:30202332 vspor708:30202333 vspor363:30204092 vslsvsres303:30308271 pythonvspyl392:30443607 vserr242:30382549 pythontb:30283811 vsjup518:30340749 pythonptprofiler:30281270 vsdfh931cf:30280410 vshan820:30294714 vstes263:30335439 vscorecescf:30445987 pythondataviewer:30285071 vscod805:30301674 binariesv615:30325510 bridge0708:30335490 bridge0723:30353136 cmake_vspar411:30581797 vsaa593cf:30376535 pythonvs932:30410667 cppdebug:30492333 vsclangdf:30486550 c4g48928:30535728 dsvsc012cf:30540253 azure-dev_surveyone:30548225 vscccc:30610679 pyindex848:30577860 nodejswelcome1cf:30587006 3biah626:30602489 3d0df643:30613357 f6dab269:30613381 fim-prod:30623723 vscup:30628656 ```
yume-chan commented 1 year ago

Duplicate of Microsoft/TypeScript#42512

vscodenpa commented 1 year ago

Thanks for creating this issue! We figured it's covering the same as another one we already have. Thus, we closed this one as a duplicate. You can search for similar existing issues. See also our issue reporting guidelines.

Happy Coding!