@vue/language-service 3.0.3 → 3.0.4

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.
Files changed (37) hide show
  1. package/index.d.ts +1 -12
  2. package/index.js +14 -15
  3. package/lib/plugins/css.js +9 -17
  4. package/lib/plugins/typescript-semantic-tokens.d.ts +2 -2
  5. package/lib/plugins/typescript-semantic-tokens.js +6 -14
  6. package/lib/plugins/utils.d.ts +8 -2
  7. package/lib/plugins/utils.js +39 -6
  8. package/lib/plugins/vue-autoinsert-dotvalue.d copy.d.ts +2 -0
  9. package/lib/plugins/vue-autoinsert-dotvalue.d copy.js +3 -0
  10. package/lib/plugins/vue-autoinsert-dotvalue.d.ts +2 -2
  11. package/lib/plugins/vue-autoinsert-dotvalue.js +15 -32
  12. package/lib/plugins/vue-compiler-dom-errors.js +17 -35
  13. package/lib/plugins/vue-component-semantic-tokens.d.ts +2 -2
  14. package/lib/plugins/vue-component-semantic-tokens.js +35 -49
  15. package/lib/plugins/vue-destructured-props-hints.d.ts +7 -0
  16. package/lib/plugins/vue-destructured-props-hints.js +220 -0
  17. package/lib/plugins/vue-document-drop.d.ts +2 -2
  18. package/lib/plugins/vue-document-drop.js +12 -26
  19. package/lib/plugins/vue-document-highlights.d.ts +1 -2
  20. package/lib/plugins/vue-document-highlights.js +6 -13
  21. package/lib/plugins/vue-extract-file.d.ts +2 -2
  22. package/lib/plugins/vue-extract-file.js +10 -25
  23. package/lib/plugins/vue-global-types-error.js +16 -16
  24. package/lib/plugins/vue-inlayhints.js +14 -15
  25. package/lib/plugins/vue-missing-props-hints.d.ts +2 -2
  26. package/lib/plugins/vue-missing-props-hints.js +7 -23
  27. package/lib/plugins/vue-scoped-class-links.d.ts +2 -0
  28. package/lib/plugins/vue-scoped-class-links.js +62 -0
  29. package/lib/plugins/vue-sfc.js +140 -143
  30. package/lib/plugins/vue-suggest-define-assignment.js +3 -13
  31. package/lib/plugins/vue-template-ref-links.d.ts +2 -0
  32. package/lib/plugins/vue-template-ref-links.js +57 -0
  33. package/lib/plugins/vue-template.d.ts +2 -2
  34. package/lib/plugins/vue-template.js +320 -353
  35. package/lib/plugins/vue-twoslash-queries.d.ts +2 -2
  36. package/lib/plugins/vue-twoslash-queries.js +6 -15
  37. package/package.json +4 -4
@@ -1,2 +1,2 @@
1
- import type { LanguageServiceContext, LanguageServicePlugin } from '@volar/language-service';
2
- export declare function create(getTsPluginClient?: (context: LanguageServiceContext) => import('@vue/typescript-plugin/lib/requests').Requests | undefined): LanguageServicePlugin;
1
+ import type { LanguageServicePlugin } from '@volar/language-service';
2
+ export declare function create(tsPluginClient: import('@vue/typescript-plugin/lib/requests').Requests | undefined): LanguageServicePlugin;
@@ -1,32 +1,23 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.create = create;
4
- const language_core_1 = require("@vue/language-core");
5
- const vscode_uri_1 = require("vscode-uri");
4
+ const utils_1 = require("./utils");
6
5
  const twoslashTemplateReg = /<!--\s*\^\?\s*-->/g;
7
6
  const twoslashScriptReg = /(?<=^|\n)\s*\/\/\s*\^\?/g;
8
- function create(getTsPluginClient) {
7
+ function create(tsPluginClient) {
9
8
  return {
10
9
  name: 'vue-twoslash-queries',
11
10
  capabilities: {
12
11
  inlayHintProvider: {},
13
12
  },
14
13
  create(context) {
15
- const tsPluginClient = getTsPluginClient?.(context);
16
14
  return {
17
15
  async provideInlayHints(document, range) {
18
- const uri = vscode_uri_1.URI.parse(document.uri);
19
- const decoded = context.decodeEmbeddedDocumentUri(uri);
20
- const sourceScript = decoded && context.language.scripts.get(decoded[0]);
21
- const virtualCode = decoded && sourceScript?.generated?.embeddedCodes.get(decoded[1]);
22
- if (!sourceScript?.generated
23
- || (virtualCode?.id !== 'template' && !virtualCode?.id.startsWith('script_'))) {
24
- return;
25
- }
26
- const root = sourceScript.generated.root;
27
- if (!(root instanceof language_core_1.VueVirtualCode)) {
16
+ const info = (0, utils_1.getEmbeddedInfo)(context, document, id => id === 'template' || id.startsWith('script_'));
17
+ if (!info) {
28
18
  return;
29
19
  }
20
+ const { sourceScript, virtualCode, root } = info;
30
21
  const hoverOffsets = [];
31
22
  const inlayHints = [];
32
23
  const twoslashReg = virtualCode.id === 'template' ? twoslashTemplateReg : twoslashScriptReg;
@@ -41,7 +32,7 @@ function create(getTsPluginClient) {
41
32
  }),
42
33
  ]);
43
34
  }
44
- const sourceDocument = context.documents.get(decoded[0], sourceScript.languageId, sourceScript.snapshot);
35
+ const sourceDocument = context.documents.get(sourceScript.id, sourceScript.languageId, sourceScript.snapshot);
45
36
  for (const [pointerPosition, hoverOffset] of hoverOffsets) {
46
37
  const map = context.language.maps.get(virtualCode, sourceScript);
47
38
  for (const [sourceOffset] of map.toSourceLocation(hoverOffset)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/language-service",
3
- "version": "3.0.3",
3
+ "version": "3.0.4",
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.20",
21
- "@vue/language-core": "3.0.3",
21
+ "@vue/language-core": "3.0.4",
22
22
  "@vue/shared": "^3.5.0",
23
23
  "path-browserify": "^1.0.1",
24
24
  "volar-service-css": "0.0.65",
@@ -37,8 +37,8 @@
37
37
  "@volar/kit": "2.4.20",
38
38
  "@volar/typescript": "2.4.20",
39
39
  "@vue/compiler-dom": "^3.5.0",
40
- "@vue/typescript-plugin": "3.0.3",
40
+ "@vue/typescript-plugin": "3.0.4",
41
41
  "vscode-css-languageservice": "^6.3.1"
42
42
  },
43
- "gitHead": "129f30ff8d8d976abf0431063be5c6c4cf88f0fd"
43
+ "gitHead": "148d386f9779c2de64cdcbd35310e03b36943b05"
44
44
  }