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

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

Merged

Conversation

KazariEX
Copy link
Collaborator

@KazariEX KazariEX commented Jul 31, 2024

resolve #4622

It will look like:

image

@KazariEX
Copy link
Collaborator Author

KazariEX commented Aug 1, 2024

Which is better?

image

image

@KazariEX
Copy link
Collaborator Author

KazariEX commented Aug 1, 2024

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

@johnsoncodehk
Copy link
Member

Which is better?

image

image

: props.foo is better. 👍

@johnsoncodehk
Copy link
Member

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
Copy link
Collaborator Author

KazariEX commented Aug 4, 2024

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
Copy link
Member

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.

@johnsoncodehk johnsoncodehk merged commit fd47493 into vuejs:master Aug 9, 2024
3 checks passed
@KazariEX KazariEX deleted the feat/inlay-hints-destructured-props branch August 9, 2024 06:37
@Mrlilili
Copy link

Is there a way to also display inlay hints for destructured props in the template?

image

@KazariEX
Copy link
Collaborator Author

Is there a way to also display inlay hints for destructured props in the template?

image

I don't think it's necessary because all variables within the template will be automatically unwrapped.

@Mrlilili
Copy link

Mrlilili commented Dec 27, 2024

Is there a way to also display inlay hints for destructured props in the template?
image

I don't think it's necessary because all variables within the template will be automatically unwrapped.

In the template, it is necessary to distinguish the source of this variable as being from props or a custom ref value,this can increase the readability of the code.


By the way,The image you replied to cannot be displayed.
image

@KazariEX
Copy link
Collaborator Author

KazariEX commented Dec 27, 2024

If Reactive Props Destructure is not used, we cannot distinguish whether the variables in the template are props. Providing inlay hints only for the former not only yields little benefit, but also causes inconsistency.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inlay hints for destructured props
4 participants