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): resolve components with various name cases correctly #5067

Merged
merged 9 commits into from
Dec 21, 2024

Conversation

KazariEX
Copy link
Collaborator

@KazariEX KazariEX commented Dec 18, 2024

Due to the kebab case component in the template causing its pascal case component name to also be accepted, remove the __VLS__resolvedLocalAndGlobalComponents that integrates all components (including components that will not actually be retrieved from it).

For example:

<script setup lang="ts">
import myComp from './my-comp.vue';
</script>

<template>
	<my-comp />
	<MyComp />
</template>

Due to my-comp being converted to pascal case and added into __VLS_resolvedLocalAndGlobalComponents, MyComp will be mistakenly considered as an existing component, however in fact myComp from the script block cannot be used in this way.

At the same time, it avoids a large amount of redundant information that may occur when displaying unknown components due to its type being unwrapped.

Before:

image

After:

image

Copy link

pkg-pr-new bot commented Dec 18, 2024

Open in Stackblitz

vue-component-meta

npm i https://pkg.pr.new/vuejs/language-tools/vue-component-meta@5067

vue-component-type-helpers

npm i https://pkg.pr.new/vuejs/language-tools/vue-component-type-helpers@5067

@vue/language-core

npm i https://pkg.pr.new/vuejs/language-tools/@vue/language-core@5067

@vue/language-plugin-pug

npm i https://pkg.pr.new/vuejs/language-tools/@vue/language-plugin-pug@5067

@vue/language-server

npm i https://pkg.pr.new/vuejs/language-tools/@vue/language-server@5067

@vue/language-service

npm i https://pkg.pr.new/vuejs/language-tools/@vue/language-service@5067

vue-tsc

npm i https://pkg.pr.new/vuejs/language-tools/vue-tsc@5067

@vue/typescript-plugin

npm i https://pkg.pr.new/vuejs/language-tools/@vue/typescript-plugin@5067

commit: 7d9f1f1

@KazariEX KazariEX marked this pull request as ready for review December 18, 2024 14:26
@johnsoncodehk johnsoncodehk force-pushed the master branch 3 times, most recently from c3e80dc to 209717c Compare December 20, 2024 21:05
@johnsoncodehk
Copy link
Member

For context, the purpose of __VLS_resolvedLocalAndGlobalComponents is to reuse the WithComponent type evaluation results for the same tags, but there is currently no evidence that __VLS_resolvedLocalAndGlobalComponents effectively improves performance, so let's merge it.

@johnsoncodehk johnsoncodehk merged commit e4ec4ea into vuejs:master Dec 21, 2024
5 checks passed
@KazariEX KazariEX deleted the fix/resolve-components branch December 21, 2024 05:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants