@vue/language-service 3.2.0 → 3.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -225,19 +225,13 @@ function create(ts, languageId, tsserver) {
225
225
  return;
226
226
  }
227
227
  const prevText = document.getText({ start: { line: 0, character: 0 }, end: position });
228
- const hint = prevText.match(/\bv[\S]*$/)
229
- ? 'v'
230
- : prevText.match(/[:][\S]*$/)
231
- ? ':'
232
- : prevText.match(/[@][\S]*$/)
233
- ? '@'
234
- : undefined;
228
+ const hint = prevText.match(/(\S)[\S]*$/)?.[1];
235
229
  const { result: htmlCompletion, info: { tagNameCasing, components, }, } = await runWithVueDataProvider(info.script.id, info.root, hint, 'completion', () => baseServiceInstance.provideCompletionItems(document, position, completionContext, token));
236
230
  const componentSet = new Set(components);
237
231
  if (!htmlCompletion) {
238
232
  return;
239
233
  }
240
- if (!prevText.match(/[\S]+$/)) {
234
+ if (!hint) {
241
235
  htmlCompletion.isIncomplete = true;
242
236
  }
243
237
  await resolveAutoImportPlaceholder(htmlCompletion, info);
@@ -564,6 +558,28 @@ function create(ts, languageId, tsserver) {
564
558
  const directives = getDirectives();
565
559
  const { attrs, meta } = getTagData(tag);
566
560
  const attributes = [];
561
+ let addPlainAttrs = false;
562
+ let addVBinds = false;
563
+ let addVBindShorthands = false;
564
+ let addVOns = false;
565
+ let addVOnShorthands = false;
566
+ if (!hint) {
567
+ addVBindShorthands = true;
568
+ addVOnShorthands = true;
569
+ }
570
+ else if (hint === ':') {
571
+ addVBindShorthands = true;
572
+ }
573
+ else if (hint === '@') {
574
+ addVOnShorthands = true;
575
+ }
576
+ else {
577
+ addPlainAttrs = true;
578
+ addVBinds = true;
579
+ addVOns = true;
580
+ addVBindShorthands = true;
581
+ addVOnShorthands = true;
582
+ }
567
583
  for (const attr of builtInData?.globalAttributes ?? []) {
568
584
  if (attr.name === 'is' && tag.toLowerCase() !== 'component') {
569
585
  continue;
@@ -572,21 +588,14 @@ function create(ts, languageId, tsserver) {
572
588
  attributes.push(attr);
573
589
  continue;
574
590
  }
575
- if (!hint || hint === ':') {
576
- attributes.push({
577
- ...attr,
578
- name: V_BIND_SHORTHAND + attr.name,
579
- });
591
+ if (addPlainAttrs) {
592
+ attributes.push({ ...attr, name: attr.name });
580
593
  }
581
- if (!hint || hint === 'v') {
582
- attributes.push({
583
- ...attr,
584
- name: DIRECTIVE_V_BIND + attr.name,
585
- });
586
- attributes.push({
587
- ...attr,
588
- name: attr.name,
589
- });
594
+ if (addVBindShorthands) {
595
+ attributes.push({ ...attr, name: V_BIND_SHORTHAND + attr.name });
596
+ }
597
+ if (addVBinds) {
598
+ attributes.push({ ...attr, name: DIRECTIVE_V_BIND + attr.name });
590
599
  }
591
600
  }
592
601
  for (const [propName, propMeta] of [
@@ -599,13 +608,13 @@ function create(ts, languageId, tsserver) {
599
608
  if (attrNameCasing === 0 /* AttrNameCasing.Kebab */) {
600
609
  labelName = (0, language_core_1.hyphenateAttr)(labelName);
601
610
  }
602
- if (!hint || hint === '@') {
611
+ if (addVOnShorthands) {
603
612
  attributes.push({
604
613
  name: V_ON_SHORTHAND + labelName,
605
614
  description: propMeta && createDescription(propMeta),
606
615
  });
607
616
  }
608
- if (!hint || hint === 'v') {
617
+ if (addVOns) {
609
618
  attributes.push({
610
619
  name: DIRECTIVE_V_ON + labelName,
611
620
  description: propMeta && createDescription(propMeta),
@@ -618,19 +627,21 @@ function create(ts, languageId, tsserver) {
618
627
  const name = attrNameCasing === 1 /* AttrNameCasing.Camel */ ? prop.name : (0, language_core_1.hyphenateAttr)(prop.name);
619
628
  return name === labelName;
620
629
  });
621
- if (!hint || hint === ':') {
630
+ if (addPlainAttrs) {
622
631
  attributes.push({
623
- name: V_BIND_SHORTHAND + labelName,
632
+ name: labelName,
624
633
  description: propMeta2 && createDescription(propMeta2),
625
634
  });
626
635
  }
627
- if (!hint || hint === 'v') {
636
+ if (addVBindShorthands) {
628
637
  attributes.push({
629
- name: DIRECTIVE_V_BIND + labelName,
638
+ name: V_BIND_SHORTHAND + labelName,
630
639
  description: propMeta2 && createDescription(propMeta2),
631
640
  });
641
+ }
642
+ if (addVBinds) {
632
643
  attributes.push({
633
- name: labelName,
644
+ name: DIRECTIVE_V_BIND + labelName,
634
645
  description: propMeta2 && createDescription(propMeta2),
635
646
  });
636
647
  }
@@ -638,13 +649,13 @@ function create(ts, languageId, tsserver) {
638
649
  }
639
650
  for (const event of meta?.events ?? []) {
640
651
  const eventName = attrNameCasing === 1 /* AttrNameCasing.Camel */ ? event.name : (0, language_core_1.hyphenateAttr)(event.name);
641
- if (!hint || hint === '@') {
652
+ if (addVOnShorthands) {
642
653
  attributes.push({
643
654
  name: V_ON_SHORTHAND + eventName,
644
655
  description: event && createDescription(event),
645
656
  });
646
657
  }
647
- if (!hint || hint === 'v') {
658
+ if (addVOns) {
648
659
  attributes.push({
649
660
  name: DIRECTIVE_V_ON + eventName,
650
661
  description: event && createDescription(event),
@@ -670,17 +681,15 @@ function create(ts, languageId, tsserver) {
670
681
  });
671
682
  }
672
683
  }
673
- if (!hint || hint === 'v') {
674
- for (const event of meta?.events ?? []) {
675
- if (event.name.startsWith(UPDATE_EVENT_PREFIX)) {
676
- const model = event.name.slice(UPDATE_EVENT_PREFIX.length);
677
- const label = DIRECTIVE_V_MODEL
678
- + (attrNameCasing === 1 /* AttrNameCasing.Camel */ ? model : (0, language_core_1.hyphenateAttr)(model));
679
- attributes.push({
680
- name: label,
681
- description: createDescription(event),
682
- });
683
- }
684
+ for (const event of meta?.events ?? []) {
685
+ if (event.name.startsWith(UPDATE_EVENT_PREFIX)) {
686
+ const model = event.name.slice(UPDATE_EVENT_PREFIX.length);
687
+ const label = DIRECTIVE_V_MODEL
688
+ + (attrNameCasing === 1 /* AttrNameCasing.Camel */ ? model : (0, language_core_1.hyphenateAttr)(model));
689
+ attributes.push({
690
+ name: label,
691
+ description: createDescription(event),
692
+ });
684
693
  }
685
694
  }
686
695
  return attributes;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/language-service",
3
- "version": "3.2.0",
3
+ "version": "3.2.1",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "data",
@@ -18,7 +18,7 @@
18
18
  },
19
19
  "dependencies": {
20
20
  "@volar/language-service": "2.4.27",
21
- "@vue/language-core": "3.2.0",
21
+ "@vue/language-core": "3.2.1",
22
22
  "@vue/shared": "^3.5.0",
23
23
  "path-browserify": "^1.0.1",
24
24
  "volar-service-css": "0.0.68",
@@ -37,8 +37,8 @@
37
37
  "@volar/kit": "2.4.27",
38
38
  "@volar/typescript": "2.4.27",
39
39
  "@vue/compiler-dom": "^3.5.0",
40
- "@vue/typescript-plugin": "3.2.0",
40
+ "@vue/typescript-plugin": "3.2.1",
41
41
  "vscode-css-languageservice": "^6.3.1"
42
42
  },
43
- "gitHead": "3138110d767d3d6110899bc46518b53c4b456271"
43
+ "gitHead": "fad5a89205579e6a0902d7ee5bae3db7b510e2f4"
44
44
  }