@vue/language-service 3.0.4 → 3.0.6

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 (46) hide show
  1. package/index.d.ts +1 -1
  2. package/index.js +21 -15
  3. package/lib/{plugins/data.js → data.js} +31 -32
  4. package/lib/plugins/css.js +1 -1
  5. package/lib/plugins/typescript-semantic-tokens.d.ts +1 -1
  6. package/lib/plugins/typescript-semantic-tokens.js +3 -3
  7. package/lib/plugins/vue-autoinsert-dotvalue.d.ts +1 -1
  8. package/lib/plugins/vue-autoinsert-dotvalue.js +8 -19
  9. package/lib/plugins/vue-autoinsert-space.js +2 -6
  10. package/lib/plugins/vue-compiler-dom-errors.js +1 -1
  11. package/lib/plugins/vue-component-semantic-tokens.d.ts +1 -1
  12. package/lib/plugins/vue-component-semantic-tokens.js +4 -4
  13. package/lib/plugins/vue-document-drop.d.ts +1 -1
  14. package/lib/plugins/vue-document-drop.js +4 -7
  15. package/lib/plugins/vue-document-highlights.d.ts +1 -1
  16. package/lib/plugins/vue-document-highlights.js +19 -3
  17. package/lib/plugins/vue-extract-file.d.ts +1 -1
  18. package/lib/plugins/vue-extract-file.js +3 -3
  19. package/lib/plugins/vue-global-types-error.js +6 -3
  20. package/lib/plugins/vue-inlayhints.js +1 -1
  21. package/lib/plugins/vue-missing-props-hints.d.ts +1 -1
  22. package/lib/plugins/vue-missing-props-hints.js +5 -5
  23. package/lib/plugins/vue-scoped-class-links.js +1 -1
  24. package/lib/plugins/vue-sfc.js +2 -2
  25. package/lib/plugins/vue-suggest-define-assignment.js +1 -1
  26. package/lib/plugins/vue-template-ref-links.js +1 -1
  27. package/lib/plugins/vue-template.d.ts +1 -1
  28. package/lib/plugins/vue-template.js +19 -21
  29. package/lib/plugins/vue-twoslash-queries.d.ts +1 -1
  30. package/lib/plugins/vue-twoslash-queries.js +3 -3
  31. package/lib/{plugins/utils.d.ts → utils.d.ts} +0 -1
  32. package/lib/{plugins/utils.js → utils.js} +0 -4
  33. package/package.json +7 -7
  34. package/lib/plugins/vue-autoinsert-dotvalue.d copy.d.ts +0 -2
  35. package/lib/plugins/vue-autoinsert-dotvalue.d copy.js +0 -3
  36. package/lib/plugins/vue-complete-define-assignment.d.ts +0 -2
  37. package/lib/plugins/vue-complete-define-assignment.js +0 -84
  38. package/lib/plugins/vue-destructured-props-hints.d.ts +0 -7
  39. package/lib/plugins/vue-destructured-props-hints.js +0 -220
  40. package/lib/plugins/vue-diagnostic-global-types.d.ts +0 -1
  41. package/lib/plugins/vue-diagnostic-global-types.js +0 -3
  42. package/lib/plugins/vue-document-links.d.ts +0 -2
  43. package/lib/plugins/vue-document-links.js +0 -109
  44. package/lib/types.d.ts +0 -13
  45. package/lib/types.js +0 -34
  46. /package/lib/{plugins/data.d.ts → data.d.ts} +0 -0
@@ -7,9 +7,9 @@ const volar_service_html_1 = require("volar-service-html");
7
7
  const volar_service_pug_1 = require("volar-service-pug");
8
8
  const html = require("vscode-html-languageservice");
9
9
  const vscode_uri_1 = require("vscode-uri");
10
+ const data_1 = require("../data");
10
11
  const nameCasing_1 = require("../nameCasing");
11
- const data_1 = require("./data");
12
- const utils_1 = require("./utils");
12
+ const utils_1 = require("../utils");
13
13
  const specialTags = new Set([
14
14
  'slot',
15
15
  'component',
@@ -25,7 +25,7 @@ const specialProps = new Set([
25
25
  ]);
26
26
  let builtInData;
27
27
  let modelData;
28
- function create(mode, tsPluginClient) {
28
+ function create(languageId, { getComponentNames, getElementAttrs, getComponentProps, getComponentEvents, getComponentDirectives, getComponentSlots, }) {
29
29
  let customData = [];
30
30
  let extraCustomData = [];
31
31
  const onDidChangeCustomDataListeners = new Set();
@@ -37,7 +37,7 @@ function create(mode, tsPluginClient) {
37
37
  },
38
38
  };
39
39
  };
40
- const baseService = mode === 'pug'
40
+ const baseService = languageId === 'jade'
41
41
  ? (0, volar_service_pug_1.create)({
42
42
  useDefaultDataProvider: false,
43
43
  getCustomData() {
@@ -60,9 +60,8 @@ function create(mode, tsPluginClient) {
60
60
  onDidChangeCustomData,
61
61
  });
62
62
  const htmlDataProvider = html.getDefaultHTMLDataProvider();
63
- const languageId = mode === 'pug' ? 'jade' : 'html';
64
63
  return {
65
- name: `vue-template (${mode})`,
64
+ name: `vue-template (${languageId})`,
66
65
  capabilities: {
67
66
  ...baseService.capabilities,
68
67
  completionProvider: {
@@ -183,7 +182,6 @@ function create(mode, tsPluginClient) {
183
182
  prop = {
184
183
  name,
185
184
  kind: 'prop',
186
- isGlobal: true,
187
185
  };
188
186
  }
189
187
  }
@@ -191,7 +189,7 @@ function create(mode, tsPluginClient) {
191
189
  if (prop) {
192
190
  const { isEvent, propName } = getPropName(prop.name, prop.kind === 'event');
193
191
  if (prop.kind === 'prop') {
194
- if (!prop.isGlobal || specialProps.has(propName)) {
192
+ if (!prop.isGlobal) {
195
193
  item.kind = 5;
196
194
  }
197
195
  }
@@ -201,7 +199,7 @@ function create(mode, tsPluginClient) {
201
199
  tokens.push('\u0004');
202
200
  }
203
201
  }
204
- if (!prop.isGlobal || specialProps.has(propName)) {
202
+ if (!prop.isGlobal) {
205
203
  tokens.push('\u0000');
206
204
  if (item.label.startsWith(':')) {
207
205
  tokens.push('\u0001');
@@ -244,6 +242,9 @@ function create(mode, tsPluginClient) {
244
242
  tokens.push('\u0001');
245
243
  }
246
244
  item.sortText = tokens.join('') + (item.sortText ?? item.label);
245
+ if (item.label === 'v-for') {
246
+ item.textEdit.newText = item.label + '="${1:value} in ${2:source}"';
247
+ }
247
248
  }
248
249
  },
249
250
  provideHover(document, position, token) {
@@ -324,7 +325,7 @@ function create(mode, tsPluginClient) {
324
325
  if (!components) {
325
326
  components = [];
326
327
  tasks.push((async () => {
327
- components = (await tsPluginClient?.getComponentNames(root.fileName) ?? [])
328
+ components = (await getComponentNames(root.fileName) ?? [])
328
329
  .filter(name => name !== 'Transition'
329
330
  && name !== 'TransitionGroup'
330
331
  && name !== 'KeepAlive'
@@ -373,10 +374,10 @@ function create(mode, tsPluginClient) {
373
374
  tagMap.set(tag, tagInfo);
374
375
  tasks.push((async () => {
375
376
  tagMap.set(tag, {
376
- attrs: await tsPluginClient?.getElementAttrs(root.fileName, tag) ?? [],
377
- propInfos: await tsPluginClient?.getComponentProps(root.fileName, tag) ?? [],
378
- events: await tsPluginClient?.getComponentEvents(root.fileName, tag) ?? [],
379
- directives: await tsPluginClient?.getComponentDirectives(root.fileName) ?? [],
377
+ attrs: await getElementAttrs(root.fileName, tag) ?? [],
378
+ propInfos: await getComponentProps(root.fileName, tag) ?? [],
379
+ events: await getComponentEvents(root.fileName, tag) ?? [],
380
+ directives: await getComponentDirectives(root.fileName) ?? [],
380
381
  });
381
382
  version++;
382
383
  })());
@@ -467,28 +468,25 @@ function create(mode, tsPluginClient) {
467
468
  ...attrs.map(attr => ({ name: attr })),
468
469
  ]) {
469
470
  if (prop.name.startsWith('onUpdate:')) {
470
- const isGlobal = !propNameSet.has(prop.name);
471
- models.push([isGlobal, prop.name.slice('onUpdate:'.length)]);
471
+ models.push(prop.name.slice('onUpdate:'.length));
472
472
  }
473
473
  }
474
474
  for (const event of events) {
475
475
  if (event.startsWith('update:')) {
476
- models.push([false, event.slice('update:'.length)]);
476
+ models.push(event.slice('update:'.length));
477
477
  }
478
478
  }
479
- for (const [isGlobal, model] of models) {
479
+ for (const model of models) {
480
480
  const name = casing.attr === nameCasing_1.AttrNameCasing.Camel ? model : (0, language_core_1.hyphenateAttr)(model);
481
481
  attributes.push({ name: 'v-model:' + name });
482
482
  propMap.set('v-model:' + name, {
483
483
  name,
484
484
  kind: 'prop',
485
- isGlobal,
486
485
  });
487
486
  if (model === 'modelValue') {
488
487
  propMap.set('v-model', {
489
488
  name,
490
489
  kind: 'prop',
491
- isGlobal,
492
490
  });
493
491
  }
494
492
  }
@@ -499,7 +497,7 @@ function create(mode, tsPluginClient) {
499
497
  values = [];
500
498
  tasks.push((async () => {
501
499
  if (tag === 'slot' && attr === 'name') {
502
- values = await tsPluginClient?.getComponentSlots(root.fileName) ?? [];
500
+ values = await getComponentSlots(root.fileName) ?? [];
503
501
  }
504
502
  version++;
505
503
  })());
@@ -1,2 +1,2 @@
1
1
  import type { LanguageServicePlugin } from '@volar/language-service';
2
- export declare function create(tsPluginClient: import('@vue/typescript-plugin/lib/requests').Requests | undefined): LanguageServicePlugin;
2
+ export declare function create({ getQuickInfoAtPosition }: import('@vue/typescript-plugin/lib/requests').Requests): LanguageServicePlugin;
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.create = create;
4
- const utils_1 = require("./utils");
4
+ const utils_1 = require("../utils");
5
5
  const twoslashTemplateReg = /<!--\s*\^\?\s*-->/g;
6
6
  const twoslashScriptReg = /(?<=^|\n)\s*\/\/\s*\^\?/g;
7
- function create(tsPluginClient) {
7
+ function create({ getQuickInfoAtPosition }) {
8
8
  return {
9
9
  name: 'vue-twoslash-queries',
10
10
  capabilities: {
@@ -36,7 +36,7 @@ function create(tsPluginClient) {
36
36
  for (const [pointerPosition, hoverOffset] of hoverOffsets) {
37
37
  const map = context.language.maps.get(virtualCode, sourceScript);
38
38
  for (const [sourceOffset] of map.toSourceLocation(hoverOffset)) {
39
- const quickInfo = await tsPluginClient?.getQuickInfoAtPosition(root.fileName, sourceDocument.positionAt(sourceOffset));
39
+ const quickInfo = await getQuickInfoAtPosition(root.fileName, sourceDocument.positionAt(sourceOffset));
40
40
  if (quickInfo) {
41
41
  inlayHints.push({
42
42
  position: { line: pointerPosition.line, character: pointerPosition.character + 2 },
@@ -1,7 +1,6 @@
1
1
  import { type LanguageServiceContext, type SourceScript, type TextDocument } from '@volar/language-service';
2
2
  import { VueVirtualCode } from '@vue/language-core';
3
3
  import { URI } from 'vscode-uri';
4
- export declare function sleep(ms: number): Promise<unknown>;
5
4
  export declare function getEmbeddedInfo(context: LanguageServiceContext, document: TextDocument, embeddedCodeId?: string | ((id: string) => boolean), languageId?: string): {
6
5
  sourceScript: Required<SourceScript<URI>>;
7
6
  virtualCode: import("@volar/language-service").VirtualCode;
@@ -1,12 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.sleep = sleep;
4
3
  exports.getEmbeddedInfo = getEmbeddedInfo;
5
4
  const language_core_1 = require("@vue/language-core");
6
5
  const vscode_uri_1 = require("vscode-uri");
7
- function sleep(ms) {
8
- return new Promise(resolve => setTimeout(resolve, ms));
9
- }
10
6
  function getEmbeddedInfo(context, document, embeddedCodeId, languageId) {
11
7
  const uri = vscode_uri_1.URI.parse(document.uri);
12
8
  const decoded = context.decodeEmbeddedDocumentUri(uri);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/language-service",
3
- "version": "3.0.4",
3
+ "version": "3.0.6",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "data",
@@ -17,8 +17,8 @@
17
17
  "update-html-data": "node ./scripts/update-html-data.js"
18
18
  },
19
19
  "dependencies": {
20
- "@volar/language-service": "2.4.20",
21
- "@vue/language-core": "3.0.4",
20
+ "@volar/language-service": "2.4.23",
21
+ "@vue/language-core": "3.0.6",
22
22
  "@vue/shared": "^3.5.0",
23
23
  "path-browserify": "^1.0.1",
24
24
  "volar-service-css": "0.0.65",
@@ -34,11 +34,11 @@
34
34
  "devDependencies": {
35
35
  "@types/node": "^22.10.4",
36
36
  "@types/path-browserify": "^1.0.1",
37
- "@volar/kit": "2.4.20",
38
- "@volar/typescript": "2.4.20",
37
+ "@volar/kit": "2.4.23",
38
+ "@volar/typescript": "2.4.23",
39
39
  "@vue/compiler-dom": "^3.5.0",
40
- "@vue/typescript-plugin": "3.0.4",
40
+ "@vue/typescript-plugin": "3.0.6",
41
41
  "vscode-css-languageservice": "^6.3.1"
42
42
  },
43
- "gitHead": "148d386f9779c2de64cdcbd35310e03b36943b05"
43
+ "gitHead": "59f8cde8a5148e54294868104312b2b0f4c30d1e"
44
44
  }
@@ -1,2 +0,0 @@
1
- import type { LanguageServiceContext, LanguageServicePlugin } from '@volar/language-service';
2
- export declare function create(ts: typeof import('typescript'), getTsPluginClient?: (context: LanguageServiceContext) => import('@vue/typescript-plugin/lib/requests').Requests | undefined): LanguageServicePlugin;
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=vue-autoinsert-dotvalue.d%20copy.js.map
@@ -1,2 +0,0 @@
1
- import type { LanguageServicePlugin } from '@volar/language-service';
2
- export declare function create(): LanguageServicePlugin;
@@ -1,84 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.create = create;
4
- const language_core_1 = require("@vue/language-core");
5
- const vscode_uri_1 = require("vscode-uri");
6
- const utils_1 = require("./utils");
7
- function create() {
8
- return {
9
- name: 'vue-complete-define-assignment',
10
- capabilities: {
11
- completionProvider: {},
12
- },
13
- create(context) {
14
- return {
15
- isAdditionalCompletion: true,
16
- async provideCompletionItems(document) {
17
- if (!(0, utils_1.isTsDocument)(document)) {
18
- return;
19
- }
20
- const enabled = await context.env.getConfiguration?.('vue.suggest.defineAssignment') ?? true;
21
- if (!enabled) {
22
- return;
23
- }
24
- const uri = vscode_uri_1.URI.parse(document.uri);
25
- const decoded = context.decodeEmbeddedDocumentUri(uri);
26
- const sourceScript = decoded && context.language.scripts.get(decoded[0]);
27
- const virtualCode = decoded && sourceScript?.generated?.embeddedCodes.get(decoded[1]);
28
- if (!sourceScript?.generated || !virtualCode) {
29
- return;
30
- }
31
- const root = sourceScript.generated.root;
32
- if (!(root instanceof language_core_1.VueVirtualCode)) {
33
- return;
34
- }
35
- const { sfc } = root;
36
- const codegen = language_core_1.tsCodegen.get(sfc);
37
- const scriptSetup = sfc.scriptSetup;
38
- const scriptSetupRanges = codegen?.getScriptSetupRanges();
39
- if (!scriptSetup || !scriptSetupRanges) {
40
- return;
41
- }
42
- const result = [];
43
- const mappings = [...context.language.maps.forEach(virtualCode)];
44
- addDefineCompletionItem(scriptSetupRanges.defineProps?.statement, scriptSetupRanges.withDefaults?.exp ?? scriptSetupRanges.defineProps?.exp, 'props');
45
- addDefineCompletionItem(scriptSetupRanges.defineEmits?.statement, scriptSetupRanges.defineEmits?.exp, 'emit');
46
- addDefineCompletionItem(scriptSetupRanges.defineSlots?.statement, scriptSetupRanges.defineSlots?.exp, 'slots');
47
- return {
48
- isIncomplete: false,
49
- items: result,
50
- };
51
- function addDefineCompletionItem(statement, exp, name) {
52
- if (!exp || exp.start !== statement?.start) {
53
- return;
54
- }
55
- let offset;
56
- for (const [, map] of mappings) {
57
- for (const [generatedOffset] of map.toGeneratedLocation(scriptSetup.startTagEnd + exp.start)) {
58
- offset = generatedOffset;
59
- break;
60
- }
61
- }
62
- if (offset === undefined) {
63
- return;
64
- }
65
- const pos = document.positionAt(offset);
66
- result.push({
67
- label: name,
68
- kind: 6,
69
- commitCharacters: ['.', ',', ';'],
70
- additionalTextEdits: [{
71
- newText: `const ${name} = `,
72
- range: {
73
- start: pos,
74
- end: pos,
75
- },
76
- }],
77
- });
78
- }
79
- },
80
- };
81
- },
82
- };
83
- }
84
- //# sourceMappingURL=vue-complete-define-assignment.js.map
@@ -1,7 +0,0 @@
1
- import type { LanguageServicePlugin } from '@volar/language-service';
2
- import type * as ts from 'typescript';
3
- export declare function create(ts: typeof import('typescript')): LanguageServicePlugin;
4
- /**
5
- * Refactored from https://github.com/vuejs/core/blob/main/packages/compiler-sfc/src/script/definePropsDestructure.ts
6
- */
7
- export declare function findDestructuredProps(ts: typeof import('typescript'), ast: ts.SourceFile, props: MapIterator<string>): [ts.Identifier, boolean][];
@@ -1,220 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.create = create;
4
- exports.findDestructuredProps = findDestructuredProps;
5
- const language_core_1 = require("@vue/language-core");
6
- const vscode_uri_1 = require("vscode-uri");
7
- function create(ts) {
8
- return {
9
- name: 'vue-destructured-props-hints',
10
- capabilities: {
11
- inlayHintProvider: {},
12
- },
13
- create(context) {
14
- return {
15
- async provideInlayHints(document) {
16
- const enabled = await context.env.getConfiguration?.('vue.inlayHints.destructuredProps') ?? false;
17
- if (!enabled) {
18
- return;
19
- }
20
- const uri = vscode_uri_1.URI.parse(document.uri);
21
- const decoded = context.decodeEmbeddedDocumentUri(uri);
22
- const sourceScript = decoded && context.language.scripts.get(decoded[0]);
23
- const virtualCode = decoded && sourceScript?.generated?.embeddedCodes.get(decoded[1]);
24
- if (!sourceScript?.generated || virtualCode?.id !== 'main') {
25
- return;
26
- }
27
- const root = sourceScript.generated.root;
28
- if (!(root instanceof language_core_1.VueVirtualCode)) {
29
- return;
30
- }
31
- const result = [];
32
- const codegen = language_core_1.tsCodegen.get(root.sfc);
33
- const scriptSetupRanges = codegen?.getScriptSetupRanges();
34
- if (!scriptSetupRanges?.defineProps?.destructured || !root.sfc.scriptSetup?.ast) {
35
- return;
36
- }
37
- for (const [prop, isShorthand] of findDestructuredProps(ts, root.sfc.scriptSetup.ast, scriptSetupRanges.defineProps.destructured.keys())) {
38
- const name = prop.text;
39
- const end = prop.getEnd();
40
- const pos = isShorthand ? end : end - name.length;
41
- const label = isShorthand ? `: props.${name}` : 'props.';
42
- result.push({
43
- label,
44
- position: document.positionAt(root.sfc.scriptSetup.startTagEnd + pos),
45
- kind: 2,
46
- });
47
- }
48
- return result;
49
- },
50
- };
51
- },
52
- };
53
- }
54
- /**
55
- * Refactored from https://github.com/vuejs/core/blob/main/packages/compiler-sfc/src/script/definePropsDestructure.ts
56
- */
57
- function findDestructuredProps(ts, ast, props) {
58
- const rootScope = Object.create(null);
59
- const scopeStack = [rootScope];
60
- let currentScope = rootScope;
61
- const excludedIds = new WeakSet();
62
- const parentStack = [];
63
- for (const prop of props) {
64
- rootScope[prop] = true;
65
- }
66
- function pushScope() {
67
- scopeStack.push(currentScope = Object.create(currentScope));
68
- }
69
- function popScope() {
70
- scopeStack.pop();
71
- currentScope = scopeStack[scopeStack.length - 1] || null;
72
- }
73
- function registerLocalBinding(id) {
74
- excludedIds.add(id);
75
- if (currentScope) {
76
- currentScope[id.text] = false;
77
- }
78
- }
79
- const references = [];
80
- walkScope(ast, true);
81
- walk(ast);
82
- return references;
83
- function walkScope(node, isRoot = false) {
84
- ts.forEachChild(node, stmt => {
85
- if (ts.isVariableStatement(stmt)) {
86
- for (const decl of stmt.declarationList.declarations) {
87
- walkVariableDeclaration(decl, isRoot);
88
- }
89
- }
90
- else if (ts.isFunctionDeclaration(stmt)
91
- || ts.isClassDeclaration(stmt)) {
92
- const declare = ts.getModifiers(stmt)?.find(modifier => modifier.kind === ts.SyntaxKind.DeclareKeyword);
93
- if (!stmt.name || declare) {
94
- return;
95
- }
96
- registerLocalBinding(stmt.name);
97
- }
98
- else if ((ts.isForOfStatement(stmt) || ts.isForInStatement(stmt))
99
- && ts.isVariableDeclarationList(stmt.initializer)) {
100
- walkVariableDeclaration(stmt.initializer.declarations[0], isRoot);
101
- }
102
- else if (ts.isLabeledStatement(stmt)
103
- && ts.isVariableDeclaration(stmt.statement)) {
104
- walkVariableDeclaration(stmt.statement, isRoot);
105
- }
106
- });
107
- }
108
- function walkVariableDeclaration(decl, isRoot = false) {
109
- const { initializer, name } = decl;
110
- const isDefineProps = isRoot
111
- && initializer
112
- && ts.isCallExpression(initializer)
113
- && initializer.expression.getText(ast) === 'defineProps';
114
- for (const { id } of (0, language_core_1.collectIdentifiers)(ts, name)) {
115
- if (isDefineProps) {
116
- excludedIds.add(id);
117
- }
118
- else {
119
- registerLocalBinding(id);
120
- }
121
- }
122
- }
123
- function walkFunctionDeclaration(node) {
124
- const { name, parameters } = node;
125
- if (name && ts.isIdentifier(name)) {
126
- registerLocalBinding(name);
127
- }
128
- for (const p of parameters) {
129
- for (const { id } of (0, language_core_1.collectIdentifiers)(ts, p)) {
130
- registerLocalBinding(id);
131
- }
132
- }
133
- }
134
- function walk(parent) {
135
- ts.forEachChild(parent, node => {
136
- if (enter(node) ?? true) {
137
- walk(node);
138
- leave(node);
139
- }
140
- });
141
- function enter(node) {
142
- if (parent) {
143
- parentStack.push(parent);
144
- }
145
- if (ts.isTypeLiteralNode(node)
146
- || ts.isTypeReferenceNode(node)) {
147
- return false;
148
- }
149
- if (ts.isFunctionLike(node)) {
150
- pushScope();
151
- walkFunctionDeclaration(node);
152
- if ('body' in node) {
153
- walkScope(node.body);
154
- }
155
- return;
156
- }
157
- if (ts.isCatchClause(node)) {
158
- pushScope();
159
- const { variableDeclaration: p } = node;
160
- if (p && ts.isIdentifier(p.name)) {
161
- registerLocalBinding(p.name);
162
- }
163
- walkScope(node.block);
164
- return;
165
- }
166
- if (ts.isBlock(node)
167
- && !ts.isFunctionLike(parent)
168
- && !ts.isCatchClause(parent)) {
169
- pushScope();
170
- walkScope(node);
171
- return;
172
- }
173
- if (ts.isIdentifier(node)
174
- && isReferencedIdentifier(node, parent)
175
- && !excludedIds.has(node)) {
176
- const name = node.text;
177
- if (currentScope[name]) {
178
- const isShorthand = ts.isShorthandPropertyAssignment(parent);
179
- references.push([node, isShorthand]);
180
- }
181
- }
182
- }
183
- function leave(node) {
184
- if (parent) {
185
- parentStack.pop();
186
- }
187
- if (ts.isFunctionLike(node)
188
- || ts.isCatchClause(node)
189
- || (ts.isBlock(node)
190
- && !ts.isFunctionLike(parent)
191
- && !ts.isCatchClause(parent))) {
192
- popScope();
193
- }
194
- }
195
- }
196
- // TODO: more conditions
197
- function isReferencedIdentifier(id, parent) {
198
- if (!parent) {
199
- return false;
200
- }
201
- if (id.text === 'arguments') {
202
- return false;
203
- }
204
- if (ts.isExpressionWithTypeArguments(parent)
205
- || ts.isInterfaceDeclaration(parent)
206
- || ts.isTypeAliasDeclaration(parent)
207
- || ts.isPropertySignature(parent)) {
208
- return false;
209
- }
210
- if (ts.isPropertyAccessExpression(parent)
211
- || ts.isPropertyAssignment(parent)
212
- || ts.isPropertyDeclaration(parent)) {
213
- if (parent.name === id) {
214
- return false;
215
- }
216
- }
217
- return true;
218
- }
219
- }
220
- //# sourceMappingURL=vue-destructured-props-hints.js.map
@@ -1 +0,0 @@
1
- export {};
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=vue-diagnostic-global-types.js.map
@@ -1,2 +0,0 @@
1
- import type { LanguageServicePlugin } from '@volar/language-service';
2
- export declare function create(): LanguageServicePlugin;