vuejs / language-tools

⚡ High-performance Vue language tooling based-on Volar.js
https://marketplace.visualstudio.com/items?itemName=Vue.volar
MIT License
5.87k stars 402 forks source link

VS Code renaming prop bound using same-name shorthand #5017

Open markbrockhoff opened 22 hours ago

markbrockhoff commented 22 hours ago

Vue - Official extension or vue-tsc version

2.1.10

VSCode version

1.95.3

Vue version

3.5.13

TypeScript version

5.6.3

System Info

No response

package.json dependencies

No response

Steps to reproduce

Bind a variable to the prop of a vue component using the same-name shorthand introduced in vue 3.4. E.g.: image

Now rename the ref using the tools built in to VS Code (shortcut: F2)

What is expected?

I'd expect that renaming the variable bound to the prop would revert to using the normal v-bind syntax so the binding still works like before, just with a new variable name. E.g.: image

What is actually happening?

At the moment the shorthand is renamed even though due to the name change it's no longer valid. E.g.: image

Link to minimal reproduction

No response

Any additional comments?

I don't think this should happen as it makes the rename functionality built into VS Code non reliable. Renaming a variable bound using the shorthand would break, or even worse, accidentially bind the value to a different prop.