From 35474d2cbb0f0ff6e65063a19067896c2a085c29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B1=B1=E5=90=B9=E8=89=B2=E5=BE=A1=E5=AE=88?= <85992002+KazariEX@users.noreply.github.com> Date: Fri, 9 Aug 2024 13:55:35 +0800 Subject: [PATCH] fix(language-service): avoid converting internal id of special tags (#4643) --- .../language-service/lib/plugins/vue-template.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/language-service/lib/plugins/vue-template.ts b/packages/language-service/lib/plugins/vue-template.ts index 57a2c24125..e5105e0ffc 100644 --- a/packages/language-service/lib/plugins/vue-template.ts +++ b/packages/language-service/lib/plugins/vue-template.ts @@ -421,10 +421,14 @@ export function create( if (builtInData.tags) { for (const tag of builtInData.tags) { + if (isInternalItemId(tag.name)) { + continue; + } + if (specialTags.has(tag.name)) { tag.name = createInternalItemId('specialTag', [tag.name]); } - if (casing.tag === TagNameCasing.Kebab) { + else if (casing.tag === TagNameCasing.Kebab) { tag.name = hyphenateTag(tag.name); } else { @@ -881,8 +885,12 @@ function createInternalItemId(type: 'componentEvent' | 'componentProp' | 'specia return '__VLS_::' + type + '::' + args.join(','); } +function isInternalItemId(key: string) { + return key.startsWith('__VLS_::'); +} + function readInternalItemId(key: string) { - if (key.startsWith('__VLS_::')) { + if (isInternalItemId(key)) { const strs = key.split('::'); return { type: strs[1] as 'componentEvent' | 'componentProp' | 'specialTag',