@vue/language-service 1.8.8 → 1.8.10

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 (55) hide show
  1. package/data/language-blocks/en.json +68 -0
  2. package/data/language-blocks/fr.json +68 -0
  3. package/data/language-blocks/ja.json +68 -0
  4. package/data/language-blocks/ko.json +68 -0
  5. package/data/language-blocks/pt.json +694 -0
  6. package/data/language-blocks/zh-cn.json +68 -0
  7. package/data/model-modifiers/en.json +12 -0
  8. package/data/model-modifiers/fr.json +12 -0
  9. package/data/model-modifiers/ja.json +12 -0
  10. package/data/model-modifiers/ko.json +12 -0
  11. package/data/model-modifiers/pt.json +116 -0
  12. package/data/model-modifiers/zh-cn.json +12 -0
  13. package/data/template/en.json +104 -0
  14. package/data/template/fr.json +104 -0
  15. package/data/template/ja.json +104 -0
  16. package/data/template/ko.json +104 -0
  17. package/data/template/pt.json +978 -0
  18. package/data/template/zh-cn.json +105 -1
  19. package/out/helpers.d.ts +1 -0
  20. package/out/helpers.js +28 -5
  21. package/out/ideFeatures/nameCasing.d.ts +7 -6
  22. package/out/ideFeatures/nameCasing.js +15 -16
  23. package/out/index.d.ts +1 -0
  24. package/out/languageService.d.ts +5 -4
  25. package/out/languageService.js +72 -47
  26. package/out/plugins/data.d.ts +1 -0
  27. package/out/plugins/data.js +9 -0
  28. package/out/plugins/vue-autoinsert-dotvalue.d.ts +2 -2
  29. package/out/plugins/vue-autoinsert-dotvalue.js +5 -4
  30. package/out/plugins/vue-autoinsert-parentheses.d.ts +2 -2
  31. package/out/plugins/vue-autoinsert-parentheses.js +3 -1
  32. package/out/plugins/vue-autoinsert-space.d.ts +2 -2
  33. package/out/plugins/vue-autoinsert-space.js +3 -1
  34. package/out/plugins/vue-codelens-references.d.ts +2 -1
  35. package/out/plugins/vue-codelens-references.js +4 -3
  36. package/out/plugins/vue-directive-comments.d.ts +2 -2
  37. package/out/plugins/vue-directive-comments.js +3 -1
  38. package/out/plugins/vue-extract-file.d.ts +2 -1
  39. package/out/plugins/vue-extract-file.js +4 -4
  40. package/out/plugins/vue-template.d.ts +2 -2
  41. package/out/plugins/vue-template.js +53 -28
  42. package/out/plugins/vue-toggle-v-bind-codeaction.d.ts +2 -1
  43. package/out/plugins/vue-toggle-v-bind-codeaction.js +6 -5
  44. package/out/plugins/vue-twoslash-queries.d.ts +2 -2
  45. package/out/plugins/vue-twoslash-queries.js +27 -2
  46. package/out/plugins/vue-visualize-hidden-callback-param.d.ts +2 -2
  47. package/out/plugins/vue-visualize-hidden-callback-param.js +3 -1
  48. package/out/plugins/vue.d.ts +2 -2
  49. package/out/plugins/vue.js +32 -4
  50. package/out/types.d.ts +1 -0
  51. package/package.json +11 -11
  52. package/out/plugins/vue-.d.ts +0 -7
  53. package/out/plugins/vue-.js +0 -159
  54. package/out/plugins/vue-autoinsert-dotvalue copy.d.ts +0 -7
  55. package/out/plugins/vue-autoinsert-dotvalue copy.js +0 -159
@@ -1,15 +1,39 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const vue = require("@vue/language-core");
26
+ exports.create = void 0;
27
+ const language_core_1 = require("@vue/language-core");
4
28
  const shared_1 = require("@vue/shared");
5
- const html = require("vscode-html-languageservice");
29
+ const html = __importStar(require("vscode-html-languageservice"));
6
30
  const helpers_1 = require("../helpers");
7
31
  const nameCasing_1 = require("../ideFeatures/nameCasing");
8
32
  const types_1 = require("../types");
9
33
  const data_1 = require("./data");
10
34
  let builtInData;
11
35
  let modelData;
12
- exports.default = (options) => (_context, modules) => {
36
+ const create = (options) => (_context, modules) => {
13
37
  const htmlOrPugService = options.baseService(_context, modules);
14
38
  const triggerCharacters = [
15
39
  ...htmlOrPugService.triggerCharacters ?? [],
@@ -56,7 +80,7 @@ exports.default = (options) => (_context, modules) => {
56
80
  return;
57
81
  for (const [_, map] of _context.documents.getMapsByVirtualFileUri(document.uri)) {
58
82
  const virtualFile = _context.documents.getSourceByUri(map.sourceFileDocument.uri)?.root;
59
- if (virtualFile && virtualFile instanceof vue.VueFile) {
83
+ if (virtualFile && virtualFile instanceof language_core_1.VueFile) {
60
84
  await provideHtmlData(map, virtualFile);
61
85
  }
62
86
  }
@@ -65,7 +89,7 @@ exports.default = (options) => (_context, modules) => {
65
89
  return;
66
90
  for (const [_, map] of _context.documents.getMapsByVirtualFileUri(document.uri)) {
67
91
  const virtualFile = _context.documents.getSourceByUri(map.sourceFileDocument.uri)?.root;
68
- if (virtualFile && virtualFile instanceof vue.VueFile) {
92
+ if (virtualFile && virtualFile instanceof language_core_1.VueFile) {
69
93
  afterHtmlCompletion(htmlComplete, map, virtualFile);
70
94
  }
71
95
  }
@@ -82,7 +106,7 @@ exports.default = (options) => (_context, modules) => {
82
106
  for (const [_, map] of _context.documents.getMapsByVirtualFileUri(document.uri)) {
83
107
  const virtualFile = _context.documents.getSourceByUri(map.sourceFileDocument.uri)?.root;
84
108
  const scanner = options.getScanner(htmlOrPugService, document);
85
- if (virtualFile && virtualFile instanceof vue.VueFile && scanner) {
109
+ if (virtualFile && virtualFile instanceof language_core_1.VueFile && scanner) {
86
110
  // visualize missing required props
87
111
  const casing = await (0, nameCasing_1.getNameCasing)(ts, _context, map.sourceFileDocument.uri, options.vueCompilerOptions);
88
112
  const components = (0, helpers_1.getComponentNames)(ts, languageService, virtualFile, options.vueCompilerOptions);
@@ -94,7 +118,7 @@ exports.default = (options) => (_context, modules) => {
94
118
  const tagName = scanner.getTokenText();
95
119
  const component = tagName.indexOf('.') >= 0
96
120
  ? components.find(component => component === tagName.split('.')[0])
97
- : components.find(component => component === tagName || (0, shared_1.hyphenate)(component) === tagName);
121
+ : components.find(component => component === tagName || (0, language_core_1.hyphenateTag)(component) === tagName);
98
122
  const checkTag = tagName.indexOf('.') >= 0 ? tagName : component;
99
123
  if (checkTag) {
100
124
  componentProps[checkTag] ??= (0, helpers_1.getPropsByTag)(ts, languageService, virtualFile, checkTag, options.vueCompilerOptions, true);
@@ -130,11 +154,11 @@ exports.default = (options) => (_context, modules) => {
130
154
  attrText = options.vueCompilerOptions.target >= 3 ? 'modelValue' : 'value'; // TODO: support for experimentalModelPropName?
131
155
  }
132
156
  else if (attrText.startsWith('@')) {
133
- attrText = 'on-' + (0, shared_1.hyphenate)(attrText.substring('@'.length));
157
+ attrText = 'on-' + (0, language_core_1.hyphenateAttr)(attrText.substring('@'.length));
134
158
  }
135
159
  current.unburnedRequiredProps = current.unburnedRequiredProps.filter(propName => {
136
160
  return attrText !== propName
137
- && attrText !== (0, shared_1.hyphenate)(propName);
161
+ && attrText !== (0, language_core_1.hyphenateAttr)(propName);
138
162
  });
139
163
  }
140
164
  }
@@ -152,7 +176,7 @@ exports.default = (options) => (_context, modules) => {
152
176
  start: document.positionAt(current.insertOffset),
153
177
  end: document.positionAt(current.insertOffset),
154
178
  },
155
- newText: ` :${casing.attr === types_1.AttrNameCasing.Kebab ? (0, shared_1.hyphenate)(requiredProp) : requiredProp}=`,
179
+ newText: ` :${casing.attr === types_1.AttrNameCasing.Kebab ? (0, language_core_1.hyphenateAttr)(requiredProp) : requiredProp}=`,
156
180
  }],
157
181
  });
158
182
  }
@@ -182,7 +206,7 @@ exports.default = (options) => (_context, modules) => {
182
206
  const originalResult = await htmlOrPugService.provideDiagnostics?.(document, token);
183
207
  for (const [_, map] of _context.documents.getMapsByVirtualFileUri(document.uri)) {
184
208
  const virtualFile = _context.documents.getSourceByUri(map.sourceFileDocument.uri)?.root;
185
- if (!virtualFile || !(virtualFile instanceof vue.VueFile))
209
+ if (!virtualFile || !(virtualFile instanceof language_core_1.VueFile))
186
210
  continue;
187
211
  const templateErrors = [];
188
212
  const sfcVueTemplateCompiled = virtualFile.compiledSFCTemplate;
@@ -227,12 +251,12 @@ exports.default = (options) => (_context, modules) => {
227
251
  const languageService = _context.inject('typescript/languageService');
228
252
  for (const [_, map] of _context.documents.getMapsByVirtualFileUri(document.uri)) {
229
253
  const virtualFile = _context.documents.getSourceByUri(map.sourceFileDocument.uri)?.root;
230
- if (!virtualFile || !(virtualFile instanceof vue.VueFile))
254
+ if (!virtualFile || !(virtualFile instanceof language_core_1.VueFile))
231
255
  continue;
232
256
  const templateScriptData = (0, helpers_1.getComponentNames)(ts, languageService, virtualFile, options.vueCompilerOptions);
233
257
  const components = new Set([
234
258
  ...templateScriptData,
235
- ...templateScriptData.map(shared_1.hyphenate),
259
+ ...templateScriptData.map(language_core_1.hyphenateTag),
236
260
  ]);
237
261
  const offsetRange = {
238
262
  start: document.offsetAt(range.start),
@@ -277,7 +301,7 @@ exports.default = (options) => (_context, modules) => {
277
301
  if (tag.name === 'template')
278
302
  continue;
279
303
  if (casing.tag === types_1.TagNameCasing.Kebab) {
280
- tag.name = (0, shared_1.hyphenate)(tag.name);
304
+ tag.name = (0, language_core_1.hyphenateTag)(tag.name);
281
305
  }
282
306
  else {
283
307
  tag.name = (0, shared_1.camelize)((0, shared_1.capitalize)(tag.name));
@@ -296,12 +320,12 @@ exports.default = (options) => (_context, modules) => {
296
320
  && name !== 'KeepAlive'
297
321
  && name !== 'Suspense'
298
322
  && name !== 'Teleport');
299
- const scriptSetupRanges = vueSourceFile.sfc.scriptSetupAst ? vue.parseScriptSetupRanges(ts, vueSourceFile.sfc.scriptSetupAst, options.vueCompilerOptions) : undefined;
323
+ const scriptSetupRanges = vueSourceFile.sfc.scriptSetupAst ? (0, language_core_1.parseScriptSetupRanges)(ts, vueSourceFile.sfc.scriptSetupAst, options.vueCompilerOptions) : undefined;
300
324
  const names = new Set();
301
325
  const tags = [];
302
326
  for (const tag of components) {
303
327
  if (casing.tag === types_1.TagNameCasing.Kebab) {
304
- names.add((0, shared_1.hyphenate)(tag));
328
+ names.add((0, language_core_1.hyphenateTag)(tag));
305
329
  }
306
330
  else if (casing.tag === types_1.TagNameCasing.Pascal) {
307
331
  names.add(tag);
@@ -310,7 +334,7 @@ exports.default = (options) => (_context, modules) => {
310
334
  for (const binding of scriptSetupRanges?.bindings ?? []) {
311
335
  const name = vueSourceFile.sfc.scriptSetup.content.substring(binding.start, binding.end);
312
336
  if (casing.tag === types_1.TagNameCasing.Kebab) {
313
- names.add((0, shared_1.hyphenate)(name));
337
+ names.add((0, language_core_1.hyphenateTag)(name));
314
338
  }
315
339
  else if (casing.tag === types_1.TagNameCasing.Pascal) {
316
340
  names.add(name);
@@ -329,15 +353,15 @@ exports.default = (options) => (_context, modules) => {
329
353
  const props = new Set((0, helpers_1.getPropsByTag)(ts, languageService, vueSourceFile, tag, options.vueCompilerOptions));
330
354
  const events = (0, helpers_1.getEventsOfTag)(ts, languageService, vueSourceFile, tag, options.vueCompilerOptions);
331
355
  const attributes = [];
332
- const tsCodegen = vue.tsCodegen.get(vueSourceFile.sfc);
333
- if (tsCodegen) {
356
+ const _tsCodegen = language_core_1.tsCodegen.get(vueSourceFile.sfc);
357
+ if (_tsCodegen) {
334
358
  let ctxVars = [
335
- ...tsCodegen.scriptRanges.value?.bindings.map(binding => vueSourceFile.sfc.script.content.substring(binding.start, binding.end)) ?? [],
336
- ...tsCodegen.scriptSetupRanges.value?.bindings.map(binding => vueSourceFile.sfc.scriptSetup.content.substring(binding.start, binding.end)) ?? [],
359
+ ..._tsCodegen.scriptRanges.value?.bindings.map(binding => vueSourceFile.sfc.script.content.substring(binding.start, binding.end)) ?? [],
360
+ ..._tsCodegen.scriptSetupRanges.value?.bindings.map(binding => vueSourceFile.sfc.scriptSetup.content.substring(binding.start, binding.end)) ?? [],
337
361
  ...(0, helpers_1.getTemplateCtx)(ts, languageService, vueSourceFile) ?? [],
338
362
  ];
339
363
  ctxVars = [...new Set(ctxVars)];
340
- const dirs = ctxVars.map(shared_1.hyphenate).filter(v => v.startsWith('v-'));
364
+ const dirs = ctxVars.map(language_core_1.hyphenateAttr).filter(v => v.startsWith('v-'));
341
365
  for (const dir of dirs) {
342
366
  attributes.push({
343
367
  name: dir,
@@ -346,8 +370,8 @@ exports.default = (options) => (_context, modules) => {
346
370
  }
347
371
  for (const prop of [...props, ...attrs]) {
348
372
  const isGlobal = !props.has(prop);
349
- const name = casing.attr === types_1.AttrNameCasing.Camel ? prop : (0, shared_1.hyphenate)(prop);
350
- if ((0, shared_1.hyphenate)(name).startsWith('on-')) {
373
+ const name = casing.attr === types_1.AttrNameCasing.Camel ? prop : (0, language_core_1.hyphenateAttr)(prop);
374
+ if ((0, language_core_1.hyphenateAttr)(name).startsWith('on-')) {
351
375
  const propNameBase = name.startsWith('on-')
352
376
  ? name.slice('on-'.length)
353
377
  : (name['on'.length].toLowerCase() + name.slice('onX'.length));
@@ -376,7 +400,7 @@ exports.default = (options) => (_context, modules) => {
376
400
  }
377
401
  }
378
402
  for (const event of events) {
379
- const name = casing.attr === types_1.AttrNameCasing.Camel ? event : (0, shared_1.hyphenate)(event);
403
+ const name = casing.attr === types_1.AttrNameCasing.Camel ? event : (0, language_core_1.hyphenateAttr)(event);
380
404
  const propKey = createInternalItemId('componentEvent', [tag, name]);
381
405
  attributes.push({
382
406
  name: 'v-on:' + name,
@@ -400,7 +424,7 @@ exports.default = (options) => (_context, modules) => {
400
424
  }
401
425
  }
402
426
  for (const [isGlobal, model] of models) {
403
- const name = casing.attr === types_1.AttrNameCasing.Camel ? model : (0, shared_1.hyphenate)(model);
427
+ const name = casing.attr === types_1.AttrNameCasing.Camel ? model : (0, language_core_1.hyphenateAttr)(model);
404
428
  const propKey = createInternalItemId('componentProp', [isGlobal ? '*' : tag, name]);
405
429
  attributes.push({
406
430
  name: 'v-model:' + name,
@@ -422,7 +446,7 @@ exports.default = (options) => (_context, modules) => {
422
446
  function afterHtmlCompletion(completionList, map, vueSourceFile) {
423
447
  const languageService = _context.inject('typescript/languageService');
424
448
  const replacement = getReplacement(completionList, map.sourceFileDocument);
425
- const componentNames = new Set((0, helpers_1.getComponentNames)(ts, languageService, vueSourceFile, options.vueCompilerOptions).map(shared_1.hyphenate));
449
+ const componentNames = new Set((0, helpers_1.getComponentNames)(ts, languageService, vueSourceFile, options.vueCompilerOptions).map(language_core_1.hyphenateTag));
426
450
  if (replacement) {
427
451
  const isEvent = replacement.text.startsWith('v-on:') || replacement.text.startsWith('@');
428
452
  const isProp = replacement.text.startsWith('v-bind:') || replacement.text.startsWith(':');
@@ -484,7 +508,7 @@ exports.default = (options) => (_context, modules) => {
484
508
  if (itemId) {
485
509
  item.documentation = undefined;
486
510
  }
487
- if (item.kind === 10 && componentNames.has((0, shared_1.hyphenate)(item.label))) {
511
+ if (item.kind === 10 && componentNames.has((0, language_core_1.hyphenateTag)(item.label))) {
488
512
  item.kind = 6;
489
513
  item.sortText = '\u0000' + (item.sortText ?? item.label);
490
514
  }
@@ -520,6 +544,7 @@ exports.default = (options) => (_context, modules) => {
520
544
  options.updateCustomData(htmlOrPugService, []);
521
545
  }
522
546
  };
547
+ exports.create = create;
523
548
  function createInternalItemId(type, args) {
524
549
  return '__VLS_::' + type + '::' + args.join(',');
525
550
  }
@@ -1,2 +1,3 @@
1
1
  import { Service } from '@volar/language-service';
2
- export default function (): Service;
2
+ export declare const create: () => Service;
3
+ //# sourceMappingURL=vue-toggle-v-bind-codeaction.d.ts.map
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.create = void 0;
3
4
  const language_core_1 = require("@vue/language-core");
4
- function default_1() {
5
+ const create = function () {
5
6
  return (ctx, modules) => {
6
7
  if (!modules?.typescript)
7
8
  return {};
@@ -26,7 +27,7 @@ function default_1() {
26
27
  for (const prop of node.props) {
27
28
  if (startOffset - templateStartOffset >= prop.loc.start.offset
28
29
  && endOffset - templateStartOffset <= prop.loc.end.offset) {
29
- if (prop.type === 7 /* NodeTypes.DIRECTIVE */ && prop.exp) {
30
+ if (prop.type === 7 && prop.exp) {
30
31
  const sourceFile = ts.createSourceFile('/a.ts', prop.exp.loc.source, ts.ScriptTarget.Latest, true);
31
32
  const firstStatement = sourceFile.statements[0];
32
33
  if (sourceFile.statements.length === 1 && ts.isExpressionStatement(firstStatement) && ts.isStringLiteralLike(firstStatement.expression)) {
@@ -54,7 +55,7 @@ function default_1() {
54
55
  });
55
56
  }
56
57
  }
57
- if (prop.type === 6 /* NodeTypes.ATTRIBUTE */) {
58
+ if (prop.type === 6) {
58
59
  const edits = [];
59
60
  const addVBindPos = document.positionAt(templateStartOffset + prop.loc.start.offset);
60
61
  edits.push({
@@ -120,6 +121,6 @@ function default_1() {
120
121
  },
121
122
  };
122
123
  };
123
- }
124
- exports.default = default_1;
124
+ };
125
+ exports.create = create;
125
126
  //# sourceMappingURL=vue-toggle-v-bind-codeaction.js.map
@@ -1,3 +1,3 @@
1
1
  import { Service } from '@volar/language-service';
2
- declare const _default: () => Service;
3
- export default _default;
2
+ export declare const create: () => Service;
3
+ //# sourceMappingURL=vue-twoslash-queries.d.ts.map
@@ -1,7 +1,31 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.create = void 0;
3
27
  const language_service_1 = require("@volar/language-service");
4
- const vue = require("@vue/language-core");
28
+ const vue = __importStar(require("@vue/language-core"));
5
29
  const twoslashReg = /<!--\s*\^\?\s*-->/g;
6
30
  const plugin = (context, modules) => {
7
31
  if (!context || !modules?.typescript)
@@ -54,5 +78,6 @@ const plugin = (context, modules) => {
54
78
  return callback(virtualFile);
55
79
  }
56
80
  };
57
- exports.default = () => plugin;
81
+ const create = () => plugin;
82
+ exports.create = create;
58
83
  //# sourceMappingURL=vue-twoslash-queries.js.map
@@ -1,3 +1,3 @@
1
1
  import { Service } from '@volar/language-service';
2
- declare const _default: () => Service;
3
- export default _default;
2
+ export declare const create: () => Service;
3
+ //# sourceMappingURL=vue-visualize-hidden-callback-param.d.ts.map
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.create = void 0;
3
4
  const plugin = (context) => {
4
5
  if (!context)
5
6
  return {};
@@ -37,5 +38,6 @@ const plugin = (context) => {
37
38
  },
38
39
  };
39
40
  };
40
- exports.default = () => plugin;
41
+ const create = () => plugin;
42
+ exports.create = create;
41
43
  //# sourceMappingURL=vue-visualize-hidden-callback-param.js.map
@@ -4,5 +4,5 @@ import * as vue from '@vue/language-core';
4
4
  export interface Provide {
5
5
  'vue/vueFile': (document: TextDocument) => vue.VueFile | undefined;
6
6
  }
7
- declare const _default: () => Service<Provide>;
8
- export default _default;
7
+ export declare const create: () => Service<Provide>;
8
+ //# sourceMappingURL=vue.d.ts.map
@@ -1,11 +1,38 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
2
28
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const html = require("vscode-html-languageservice");
4
- const volar_service_html_1 = require("volar-service-html");
5
- const vue = require("@vue/language-core");
29
+ exports.create = void 0;
30
+ const html = __importStar(require("vscode-html-languageservice"));
31
+ const volar_service_html_1 = __importDefault(require("volar-service-html"));
32
+ const vue = __importStar(require("@vue/language-core"));
6
33
  const data_1 = require("./data");
7
34
  let sfcDataProvider;
8
- exports.default = () => (context, modules) => {
35
+ const create = () => (context, modules) => {
9
36
  const htmlPlugin = (0, volar_service_html_1.default)({ validLang: 'vue', disableCustomData: true })(context, modules);
10
37
  if (!context)
11
38
  return htmlPlugin;
@@ -164,4 +191,5 @@ exports.default = () => (context, modules) => {
164
191
  }
165
192
  }
166
193
  };
194
+ exports.create = create;
167
195
  //# sourceMappingURL=vue.js.map
package/out/types.d.ts CHANGED
@@ -8,3 +8,4 @@ export declare enum AttrNameCasing {
8
8
  }
9
9
  export * from '@volar/language-service/out/types';
10
10
  export * from '@vue/language-core/out/types';
11
+ //# sourceMappingURL=types.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/language-service",
3
- "version": "1.8.8",
3
+ "version": "1.8.10",
4
4
  "main": "out/index.js",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -21,17 +21,17 @@
21
21
  "@volar/language-service": "~1.10.0",
22
22
  "@volar/typescript": "~1.10.0",
23
23
  "@vue/compiler-dom": "^3.3.0",
24
- "@vue/language-core": "1.8.8",
24
+ "@vue/language-core": "1.8.10",
25
25
  "@vue/reactivity": "^3.3.0",
26
26
  "@vue/shared": "^3.3.0",
27
- "volar-service-css": "0.0.11",
28
- "volar-service-emmet": "0.0.11",
29
- "volar-service-html": "0.0.11",
30
- "volar-service-json": "0.0.11",
31
- "volar-service-pug": "0.0.11",
32
- "volar-service-pug-beautify": "0.0.11",
33
- "volar-service-typescript": "0.0.11",
34
- "volar-service-typescript-twoslash-queries": "0.0.11",
27
+ "volar-service-css": "0.0.13",
28
+ "volar-service-emmet": "0.0.13",
29
+ "volar-service-html": "0.0.13",
30
+ "volar-service-json": "0.0.13",
31
+ "volar-service-pug": "0.0.13",
32
+ "volar-service-pug-beautify": "0.0.13",
33
+ "volar-service-typescript": "0.0.13",
34
+ "volar-service-typescript-twoslash-queries": "0.0.13",
35
35
  "vscode-html-languageservice": "^5.0.4",
36
36
  "vscode-languageserver-textdocument": "^1.0.8"
37
37
  },
@@ -40,5 +40,5 @@
40
40
  "vscode-languageserver-protocol": "^3.17.3",
41
41
  "vscode-uri": "^3.0.7"
42
42
  },
43
- "gitHead": "62a08c35722319bcca90ea3ebd3236fbd986a6a6"
43
+ "gitHead": "97d60fa475b653fe435a7fae6e2a626821658351"
44
44
  }
@@ -1,7 +0,0 @@
1
- import { AutoInsertionContext, Service } from '@volar/language-service';
2
- import type * as ts from 'typescript/lib/tsserverlibrary';
3
- import type { TextDocument } from 'vscode-languageserver-textdocument';
4
- declare const _default: () => Service;
5
- export default _default;
6
- export declare function isCharacterTyping(document: TextDocument, options: AutoInsertionContext): boolean;
7
- export declare function isBlacklistNode(ts: typeof import('typescript/lib/tsserverlibrary'), node: ts.Node, pos: number, allowAccessDotValue: boolean): boolean;
@@ -1,159 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isBlacklistNode = exports.isCharacterTyping = void 0;
4
- const shared_1 = require("@vue/shared");
5
- const plugin = (context, modules) => {
6
- if (!modules?.typescript)
7
- return {};
8
- const ts = modules.typescript;
9
- return {
10
- async provideAutoInsertionEdit(document, position, insertContext) {
11
- if (!isTsDocument(document))
12
- return;
13
- if (!isCharacterTyping(document, insertContext))
14
- return;
15
- const enabled = await context.env.getConfiguration?.('vue.autoInsert.dotValue') ?? true;
16
- if (!enabled)
17
- return;
18
- const program = context.inject('typescript/languageService').getProgram();
19
- if (!program)
20
- return;
21
- const sourceFile = program.getSourceFile(context.env.uriToFileName(document.uri));
22
- if (!sourceFile)
23
- return;
24
- if (isBlacklistNode(ts, sourceFile, document.offsetAt(position), false))
25
- return;
26
- const node = findPositionIdentifier(sourceFile, sourceFile, document.offsetAt(position));
27
- if (!node)
28
- return;
29
- const token = context.inject('typescript/languageServiceHost').getCancellationToken?.();
30
- if (token) {
31
- context.inject('typescript/languageService').getQuickInfoAtPosition(context.env.uriToFileName(document.uri), node.end);
32
- if (token?.isCancellationRequested()) {
33
- return; // check cancel here because type checker do not use cancel token
34
- }
35
- }
36
- const checker = program.getTypeChecker();
37
- const type = checker.getTypeAtLocation(node);
38
- const props = type.getProperties();
39
- if (props.some(prop => prop.name === 'value')) {
40
- return '${1:.value}';
41
- }
42
- function findPositionIdentifier(sourceFile, node, offset) {
43
- let result;
44
- node.forEachChild(child => {
45
- if (!result) {
46
- if (child.end === offset && ts.isIdentifier(child)) {
47
- result = child;
48
- }
49
- else if (child.end >= offset && child.getStart(sourceFile) < offset) {
50
- result = findPositionIdentifier(sourceFile, child, offset);
51
- }
52
- }
53
- });
54
- return result;
55
- }
56
- },
57
- };
58
- };
59
- exports.default = () => plugin;
60
- function isTsDocument(document) {
61
- return document.languageId === 'javascript' ||
62
- document.languageId === 'typescript' ||
63
- document.languageId === 'javascriptreact' ||
64
- document.languageId === 'typescriptreact';
65
- }
66
- function isCharacterTyping(document, options) {
67
- const lastCharacter = options.lastChange.text[options.lastChange.text.length - 1];
68
- const rangeStart = options.lastChange.range.start;
69
- const position = {
70
- line: rangeStart.line,
71
- character: rangeStart.character + options.lastChange.text.length,
72
- };
73
- const nextCharacter = document.getText({
74
- start: position,
75
- end: { line: position.line, character: position.character + 1 },
76
- });
77
- if (lastCharacter === undefined) { // delete text
78
- return false;
79
- }
80
- if (options.lastChange.text.indexOf('\n') >= 0) { // multi-line change
81
- return false;
82
- }
83
- return /\w/.test(lastCharacter) && !/\w/.test(nextCharacter);
84
- }
85
- exports.isCharacterTyping = isCharacterTyping;
86
- function isBlacklistNode(ts, node, pos, allowAccessDotValue) {
87
- if (ts.isVariableDeclaration(node) && pos >= node.name.getFullStart() && pos <= node.name.getEnd()) {
88
- return true;
89
- }
90
- else if (ts.isFunctionDeclaration(node) && node.name && pos >= node.name.getFullStart() && pos <= node.name.getEnd()) {
91
- return true;
92
- }
93
- else if (ts.isParameter(node) && pos >= node.name.getFullStart() && pos <= node.name.getEnd()) {
94
- return true;
95
- }
96
- else if (ts.isPropertyAssignment(node) && pos >= node.name.getFullStart() && pos <= node.name.getEnd()) {
97
- return true;
98
- }
99
- else if (ts.isShorthandPropertyAssignment(node)) {
100
- return true;
101
- }
102
- else if (ts.isImportDeclaration(node)) {
103
- return true;
104
- }
105
- else if (ts.isLiteralTypeNode(node)) {
106
- return true;
107
- }
108
- else if (ts.isTypeReferenceNode(node)) {
109
- return true;
110
- }
111
- else if (!allowAccessDotValue && ts.isPropertyAccessExpression(node) && node.expression.end === pos && node.name.text === 'value') {
112
- return true;
113
- }
114
- else if (ts.isCallExpression(node)
115
- && ts.isIdentifier(node.expression)
116
- && isWatchOrUseFunction(node.expression.text)
117
- && isTopLevelArgOrArrayTopLevelItemItem(node)) {
118
- return true;
119
- }
120
- else {
121
- let _isBlacklistNode = false;
122
- node.forEachChild(node => {
123
- if (_isBlacklistNode)
124
- return;
125
- if (pos >= node.getFullStart() && pos <= node.getEnd()) {
126
- if (isBlacklistNode(ts, node, pos, allowAccessDotValue)) {
127
- _isBlacklistNode = true;
128
- }
129
- }
130
- });
131
- return _isBlacklistNode;
132
- }
133
- function isWatchOrUseFunction(fnName) {
134
- return fnName === 'watch'
135
- || fnName === 'unref'
136
- || fnName === 'triggerRef'
137
- || fnName === 'isRef'
138
- || (0, shared_1.hyphenate)(fnName).startsWith('use-');
139
- }
140
- function isTopLevelArgOrArrayTopLevelItemItem(node) {
141
- for (const arg of node.arguments) {
142
- if (pos >= arg.getFullStart() && pos <= arg.getEnd()) {
143
- if (ts.isIdentifier(arg)) {
144
- return true;
145
- }
146
- if (ts.isArrayLiteralExpression(arg)) {
147
- for (const el of arg.elements) {
148
- if (pos >= el.getFullStart() && pos <= el.getEnd()) {
149
- return ts.isIdentifier(el);
150
- }
151
- }
152
- }
153
- return false;
154
- }
155
- }
156
- }
157
- }
158
- exports.isBlacklistNode = isBlacklistNode;
159
- //# sourceMappingURL=vue-.js.map
@@ -1,7 +0,0 @@
1
- import { AutoInsertionContext, Service } from '@volar/language-service';
2
- import type * as ts from 'typescript/lib/tsserverlibrary';
3
- import type { TextDocument } from 'vscode-languageserver-textdocument';
4
- declare const _default: () => Service;
5
- export default _default;
6
- export declare function isCharacterTyping(document: TextDocument, options: AutoInsertionContext): boolean;
7
- export declare function isBlacklistNode(ts: typeof import('typescript/lib/tsserverlibrary'), node: ts.Node, pos: number, allowAccessDotValue: boolean): boolean;