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

fix(language-core): type-checking not working with hyphen in slot name with JS #4478

Merged
merged 9 commits into from
Jul 20, 2024

Conversation

KermanX
Copy link
Collaborator

@KermanX KermanX commented Jun 18, 2024

WIP. Want to fix #3819.

The related TypeScript issue (microsoft/TypeScript#58908) indicates that this TypeScript behavior might not be fixed in a short time on TypeScriript's side. So this PR means to solve this on Volar's side.

Previously, the virtual code for

<Comp> <template #a-b="s" /> <Comp>

was

__VLS_elementAsFunction(__VLS_intrinsicElements.template, __VLS_intrinsicElements.template)({});
{
const [s] = __VLS_getSlotParams((__VLS_4.slots!)["a-b"]);
}

Now, is should be

__VLS_elementAsFunction(__VLS_intrinsicElements.template, __VLS_intrinsicElements.template)({});
{
const {["a-b"]:__VLS_thisSlot} = __VLS_4.slots!;
//        ^T1
const [s] = __VLS_getSlotParams(__VLS_thisSlot);
}

The information should be provided by T1.

However, because I am new to Volar, I can't figure out how to make this work correctly. The generated virtual code is OK now, but the hint for #a-b still doesn't show (If a-b is not a defined slot). This is quite strange.

@KermanX KermanX changed the title docs: fix wrong links in CHANGELOG.md fix: hint not working with slash in slot name Jun 18, 2024
@KermanX KermanX marked this pull request as draft June 18, 2024 16:36
@KermanX KermanX marked this pull request as ready for review June 19, 2024 02:37
@johnsoncodehk johnsoncodehk force-pushed the master branch 19 times, most recently from c6cab9a to ab8df96 Compare July 4, 2024 08:29
@KermanX KermanX changed the title fix: hint not working with slash in slot name fix: hint not working with hyphen in slot name Jul 15, 2024
@johnsoncodehk
Copy link
Member

I reverted the added language-service/inlay-hint/slot-with-hyphen test because it currently fails and does not reflect the #3819 bug. We can now merge this PR and try to fix inlay hint in the future.

@johnsoncodehk johnsoncodehk changed the title fix: hint not working with hyphen in slot name fix(language-core): type-checking not working with hyphen in slot name with JS Jul 20, 2024
@johnsoncodehk johnsoncodehk merged commit 0773781 into vuejs:master Jul 20, 2024
3 checks passed
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.

use kebab in defineSlot will lose ts-check
2 participants