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 400 forks source link

feat(language-core): inlay hints for destructured props #4634

Closed KazariEX closed 3 months ago

KazariEX commented 3 months ago

resolve #4622

It will look like:

image

KazariEX commented 3 months ago

Which is better?

image

image

KazariEX commented 3 months ago

I'm unsure why it isn't getting any inlayHints... I'd appreciate understanding the correct solution.

johnsoncodehk commented 3 months ago

Which is better?

image

image

: props.foo is better. 👍

johnsoncodehk commented 3 months ago

This is close to complete! However, executing findDestructuredProps in codegen affects the performance of vue-tsc. I am refactoring to move the logic related to inlay hints to the language-service package to avoid unnecessary computations in vue-tsc

KazariEX commented 3 months ago

Actually I implemented it in the language-service at first, and only tried to implement it in codegen after being reminded about the magic of __hint.

Additionally, I noticed a feature about tracking reactive variables in the Insiders version. Does this imply that they can extract reusable logic?

johnsoncodehk commented 3 months ago

Additionally, I noticed a feature about tracking reactive variables in the Insiders version. Does this imply that they can extract reusable logic?

My impression is that the logic is different, it's okay let's see if we can reduce the code after merging this.