Skip to content

Commit 968c00f

Browse files
committed
refactor(language-service): remove redundant isGlobal checks for models and special props
1 parent 690689e commit 968c00f

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

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

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,6 @@ export function create(
236236
prop = {
237237
name,
238238
kind: 'prop',
239-
isGlobal: true,
240239
};
241240
}
242241
}
@@ -247,7 +246,7 @@ export function create(
247246
const { isEvent, propName } = getPropName(prop.name, prop.kind === 'event');
248247

249248
if (prop.kind === 'prop') {
250-
if (!prop.isGlobal || specialProps.has(propName)) {
249+
if (!prop.isGlobal) {
251250
item.kind = 5 satisfies typeof CompletionItemKind.Field;
252251
}
253252
}
@@ -258,7 +257,7 @@ export function create(
258257
}
259258
}
260259

261-
if (!prop.isGlobal || specialProps.has(propName)) {
260+
if (!prop.isGlobal) {
262261
tokens.push('\u0000');
263262

264263
if (item.label.startsWith(':')) {
@@ -573,7 +572,7 @@ export function create(
573572
});
574573
}
575574

576-
const models: [boolean, string][] = [];
575+
const models: string[] = [];
577576

578577
for (
579578
const prop of [
@@ -582,31 +581,28 @@ export function create(
582581
]
583582
) {
584583
if (prop.name.startsWith('onUpdate:')) {
585-
const isGlobal = !propNameSet.has(prop.name);
586-
models.push([isGlobal, prop.name.slice('onUpdate:'.length)]);
584+
models.push(prop.name.slice('onUpdate:'.length));
587585
}
588586
}
589587
for (const event of events) {
590588
if (event.startsWith('update:')) {
591-
models.push([false, event.slice('update:'.length)]);
589+
models.push(event.slice('update:'.length));
592590
}
593591
}
594592

595-
for (const [isGlobal, model] of models) {
593+
for (const model of models) {
596594
const name = casing.attr === AttrNameCasing.Camel ? model : hyphenateAttr(model);
597595

598596
attributes.push({ name: 'v-model:' + name });
599597
propMap.set('v-model:' + name, {
600598
name,
601599
kind: 'prop',
602-
isGlobal,
603600
});
604601

605602
if (model === 'modelValue') {
606603
propMap.set('v-model', {
607604
name,
608605
kind: 'prop',
609-
isGlobal,
610606
});
611607
}
612608
}

0 commit comments

Comments
 (0)