From 4d1e2d65547ab8506f523911e781a77cd48af90e 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, 6 Dec 2024 01:27:01 +0800 Subject: [PATCH] fix(language-service): handle text edit of special closing tags completion correctly (#5016) --- packages/language-service/lib/plugins/vue-template.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/language-service/lib/plugins/vue-template.ts b/packages/language-service/lib/plugins/vue-template.ts index afef4331ad..5d0baf1d2d 100644 --- a/packages/language-service/lib/plugins/vue-template.ts +++ b/packages/language-service/lib/plugins/vue-template.ts @@ -778,14 +778,16 @@ export function create( if (resolvedLabelKey) { const name = resolvedLabelKey.tag; item.label = resolvedLabelKey.leadingSlash ? '/' + name : name; + + const text = resolvedLabelKey.leadingSlash ? `/${name}>` : name; if (item.textEdit) { - item.textEdit.newText = name; + item.textEdit.newText = text; }; if (item.insertText) { - item.insertText = name; + item.insertText = text; } if (item.sortText) { - item.sortText = name; + item.sortText = text; } }