@volar/typescript 2.2.2 → 2.2.3

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.
@@ -217,27 +217,32 @@ function decorateLanguageService(language, languageService) {
217
217
  combine.displayParts = combine.displayParts?.slice();
218
218
  combine.documentation = combine.documentation?.slice();
219
219
  combine.tags = combine.tags?.slice();
220
+ const displayPartsStrs = new Set([displayPartsToString(infos[0].displayParts)]);
221
+ const documentationStrs = new Set([displayPartsToString(infos[0].documentation)]);
222
+ const tagsStrs = new Set();
223
+ for (const tag of infos[0].tags ?? []) {
224
+ tagsStrs.add(tag.name + '__volar__' + displayPartsToString(tag.text));
225
+ }
220
226
  for (let i = 1; i < infos.length; i++) {
221
227
  const { displayParts, documentation, tags } = infos[i];
222
- if (!combine.displayParts) {
223
- combine.displayParts = displayParts;
224
- }
225
- else if (displayParts?.length) {
228
+ if (displayParts?.length && !displayPartsStrs.has(displayPartsToString(displayParts))) {
229
+ displayPartsStrs.add(displayPartsToString(displayParts));
230
+ combine.displayParts ??= [];
226
231
  combine.displayParts.push({ ...displayParts[0], text: '\n\n' + displayParts[0].text });
227
232
  combine.displayParts.push(...displayParts.slice(1));
228
233
  }
229
- if (!combine.documentation) {
230
- combine.documentation = documentation;
231
- }
232
- else if (documentation?.length) {
234
+ if (documentation?.length && !documentationStrs.has(displayPartsToString(documentation))) {
235
+ documentationStrs.add(displayPartsToString(documentation));
236
+ combine.documentation ??= [];
233
237
  combine.documentation.push({ ...documentation[0], text: '\n\n' + documentation[0].text });
234
238
  combine.documentation.push(...documentation.slice(1));
235
239
  }
236
- if (!combine.tags) {
237
- combine.tags = tags;
238
- }
239
- else if (tags?.length) {
240
- combine.tags.push(...tags);
240
+ for (const tag of tags ?? []) {
241
+ if (!tagsStrs.has(tag.name + '__volar__' + displayPartsToString(tag.text))) {
242
+ tagsStrs.add(tag.name + '__volar__' + displayPartsToString(tag.text));
243
+ combine.tags ??= [];
244
+ combine.tags.push(tag);
245
+ }
241
246
  }
242
247
  }
243
248
  return combine;
@@ -574,7 +579,7 @@ function decorateLanguageService(language, languageService) {
574
579
  continue;
575
580
  }
576
581
  const result = getCompletionsAtPosition(fileName, generatedOffset, options, formattingSettings);
577
- if (!result || !result.entries.length) {
582
+ if (!result) {
578
583
  continue;
579
584
  }
580
585
  if (typeof mapping.data.completion === 'object' && mapping.data.completion.onlyImport) {
@@ -590,7 +595,7 @@ function decorateLanguageService(language, languageService) {
590
595
  results.push(result);
591
596
  }
592
597
  else {
593
- results.splice(0, 0, result);
598
+ results.unshift(result);
594
599
  }
595
600
  }
596
601
  if (results.length) {
@@ -714,4 +719,10 @@ function decorateLanguageService(language, languageService) {
714
719
  }
715
720
  }
716
721
  exports.decorateLanguageService = decorateLanguageService;
722
+ function displayPartsToString(displayParts) {
723
+ if (displayParts) {
724
+ return displayParts.map(displayPart => displayPart.text).join('');
725
+ }
726
+ return '';
727
+ }
717
728
  //# sourceMappingURL=decorateLanguageService.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volar/typescript",
3
- "version": "2.2.2",
3
+ "version": "2.2.3",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "**/*.js",
@@ -12,13 +12,13 @@
12
12
  "directory": "packages/typescript"
13
13
  },
14
14
  "dependencies": {
15
- "@volar/language-core": "2.2.2",
15
+ "@volar/language-core": "2.2.3",
16
16
  "path-browserify": "^1.0.1"
17
17
  },
18
18
  "devDependencies": {
19
19
  "@types/node": "latest",
20
20
  "@types/path-browserify": "latest",
21
- "@volar/language-service": "2.2.2"
21
+ "@volar/language-service": "2.2.3"
22
22
  },
23
- "gitHead": "8aa41e4c2ab1e954b8c777f789b7a948972e77aa"
23
+ "gitHead": "189ea5c663630358a9ad965c50d2bee69a9d84eb"
24
24
  }