Skip to content

Commit 0b174e9

Browse files
committed
Update vue-template.ts
1 parent 3750308 commit 0b174e9

File tree

1 file changed

+16
-24
lines changed

1 file changed

+16
-24
lines changed

packages/language-service/lib/plugins/vue-template.ts

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ export function create(
274274
if (!htmlCompletion) {
275275
return;
276276
}
277-
if (!hint) {
277+
if (!prevText.match(/\b[\S]+$/)) {
278278
htmlCompletion.isIncomplete = true;
279279
}
280280

@@ -712,15 +712,10 @@ export function create(
712712
labelName = hyphenateAttr(labelName);
713713
}
714714

715-
const label = !hint || hint === '@'
716-
? V_ON_SHORTHAND + labelName
717-
: hint === 'v'
718-
? DIRECTIVE_V_ON + labelName
719-
: undefined;
720-
721-
if (label) {
715+
if (!hint || hint === '@' || hint === 'v') {
716+
const prefix = !hint || hint === '@' ? V_ON_SHORTHAND : DIRECTIVE_V_ON;
722717
attributes.push({
723-
name: label,
718+
name: prefix + labelName,
724719
description: propMeta && createDescription(propMeta),
725720
});
726721
}
@@ -731,31 +726,28 @@ export function create(
731726
const name = attrNameCasing === AttrNameCasing.Camel ? prop.name : hyphenateAttr(prop.name);
732727
return name === labelName;
733728
});
734-
const label = !hint || hint === ':'
735-
? V_BIND_SHORTHAND + labelName
736-
: hint === 'v'
737-
? DIRECTIVE_V_BIND + labelName
738-
: undefined;
739-
740-
if (label) {
729+
if (!hint || hint === ':' || hint === 'v') {
730+
const prefix = !hint || hint === ':' ? V_BIND_SHORTHAND : DIRECTIVE_V_BIND;
741731
attributes.push({
742-
name: label,
732+
name: prefix + labelName,
733+
description: propMeta2 && createDescription(propMeta2),
734+
});
735+
}
736+
if (!hint || hint === 'v') {
737+
attributes.push({
738+
name: labelName,
743739
description: propMeta2 && createDescription(propMeta2),
744740
});
745741
}
746742
}
747743
}
748744
for (const event of meta?.events ?? []) {
749745
const eventName = attrNameCasing === AttrNameCasing.Camel ? event.name : hyphenateAttr(event.name);
750-
const label = !hint || hint === '@'
751-
? V_ON_SHORTHAND + eventName
752-
: hint === 'v'
753-
? DIRECTIVE_V_ON + eventName
754-
: undefined;
755746

756-
if (label) {
747+
if (!hint || hint === '@' || hint === 'v') {
748+
const prefix = !hint || hint === '@' ? V_ON_SHORTHAND : DIRECTIVE_V_ON;
757749
attributes.push({
758-
name: label,
750+
name: prefix + eventName,
759751
description: event && createDescription(event),
760752
});
761753
}

0 commit comments

Comments
 (0)