@vue/language-service 1.8.8 → 1.8.11

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 +86 -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
@@ -32,6 +32,10 @@
32
32
  {
33
33
  "name": "ko",
34
34
  "url": "https://ko.vuejs.org/api/built-in-components.html#transition"
35
+ },
36
+ {
37
+ "name": "pt",
38
+ "url": "https://pt.vuejs.org/api/built-in-components.html#transition"
35
39
  }
36
40
  ]
37
41
  },
@@ -66,6 +70,10 @@
66
70
  {
67
71
  "name": "ko",
68
72
  "url": "https://ko.vuejs.org/api/built-in-components.html#transitiongroup"
73
+ },
74
+ {
75
+ "name": "pt",
76
+ "url": "https://pt.vuejs.org/api/built-in-components.html#transitiongroup"
69
77
  }
70
78
  ]
71
79
  },
@@ -100,6 +108,10 @@
100
108
  {
101
109
  "name": "ko",
102
110
  "url": "https://ko.vuejs.org/api/built-in-components.html#keepalive"
111
+ },
112
+ {
113
+ "name": "pt",
114
+ "url": "https://pt.vuejs.org/api/built-in-components.html#keepalive"
103
115
  }
104
116
  ]
105
117
  },
@@ -134,6 +146,10 @@
134
146
  {
135
147
  "name": "ko",
136
148
  "url": "https://ko.vuejs.org/api/built-in-components.html#teleport"
149
+ },
150
+ {
151
+ "name": "pt",
152
+ "url": "https://pt.vuejs.org/api/built-in-components.html#teleport"
137
153
  }
138
154
  ]
139
155
  },
@@ -168,6 +184,10 @@
168
184
  {
169
185
  "name": "ko",
170
186
  "url": "https://ko.vuejs.org/api/built-in-components.html#suspense"
187
+ },
188
+ {
189
+ "name": "pt",
190
+ "url": "https://pt.vuejs.org/api/built-in-components.html#suspense"
171
191
  }
172
192
  ]
173
193
  },
@@ -202,6 +222,10 @@
202
222
  {
203
223
  "name": "ko",
204
224
  "url": "https://ko.vuejs.org/api/built-in-special-elements.html#component"
225
+ },
226
+ {
227
+ "name": "pt",
228
+ "url": "https://pt.vuejs.org/api/built-in-special-elements.html#component"
205
229
  }
206
230
  ]
207
231
  },
@@ -236,6 +260,10 @@
236
260
  {
237
261
  "name": "ko",
238
262
  "url": "https://ko.vuejs.org/api/built-in-special-elements.html#slot"
263
+ },
264
+ {
265
+ "name": "pt",
266
+ "url": "https://pt.vuejs.org/api/built-in-special-elements.html#slot"
239
267
  }
240
268
  ]
241
269
  },
@@ -270,6 +298,10 @@
270
298
  {
271
299
  "name": "ko",
272
300
  "url": "https://ko.vuejs.org/api/built-in-special-elements.html#template"
301
+ },
302
+ {
303
+ "name": "pt",
304
+ "url": "https://pt.vuejs.org/api/built-in-special-elements.html#template"
273
305
  }
274
306
  ]
275
307
  }
@@ -305,6 +337,10 @@
305
337
  {
306
338
  "name": "ko",
307
339
  "url": "https://ko.vuejs.org/api/built-in-directives.html#v-text"
340
+ },
341
+ {
342
+ "name": "pt",
343
+ "url": "https://pt.vuejs.org/api/built-in-directives.html#v-text"
308
344
  }
309
345
  ]
310
346
  },
@@ -338,6 +374,10 @@
338
374
  {
339
375
  "name": "ko",
340
376
  "url": "https://ko.vuejs.org/api/built-in-directives.html#v-html"
377
+ },
378
+ {
379
+ "name": "pt",
380
+ "url": "https://pt.vuejs.org/api/built-in-directives.html#v-html"
341
381
  }
342
382
  ]
343
383
  },
@@ -371,6 +411,10 @@
371
411
  {
372
412
  "name": "ko",
373
413
  "url": "https://ko.vuejs.org/api/built-in-directives.html#v-show"
414
+ },
415
+ {
416
+ "name": "pt",
417
+ "url": "https://pt.vuejs.org/api/built-in-directives.html#v-show"
374
418
  }
375
419
  ]
376
420
  },
@@ -404,6 +448,10 @@
404
448
  {
405
449
  "name": "ko",
406
450
  "url": "https://ko.vuejs.org/api/built-in-directives.html#v-if"
451
+ },
452
+ {
453
+ "name": "pt",
454
+ "url": "https://pt.vuejs.org/api/built-in-directives.html#v-if"
407
455
  }
408
456
  ]
409
457
  },
@@ -438,6 +486,10 @@
438
486
  {
439
487
  "name": "ko",
440
488
  "url": "https://ko.vuejs.org/api/built-in-directives.html#v-else"
489
+ },
490
+ {
491
+ "name": "pt",
492
+ "url": "https://pt.vuejs.org/api/built-in-directives.html#v-else"
441
493
  }
442
494
  ]
443
495
  },
@@ -471,6 +523,10 @@
471
523
  {
472
524
  "name": "ko",
473
525
  "url": "https://ko.vuejs.org/api/built-in-directives.html#v-else-if"
526
+ },
527
+ {
528
+ "name": "pt",
529
+ "url": "https://pt.vuejs.org/api/built-in-directives.html#v-else-if"
474
530
  }
475
531
  ]
476
532
  },
@@ -504,6 +560,10 @@
504
560
  {
505
561
  "name": "ko",
506
562
  "url": "https://ko.vuejs.org/api/built-in-directives.html#v-for"
563
+ },
564
+ {
565
+ "name": "pt",
566
+ "url": "https://pt.vuejs.org/api/built-in-directives.html#v-for"
507
567
  }
508
568
  ]
509
569
  },
@@ -537,6 +597,10 @@
537
597
  {
538
598
  "name": "ko",
539
599
  "url": "https://ko.vuejs.org/api/built-in-directives.html#v-on"
600
+ },
601
+ {
602
+ "name": "pt",
603
+ "url": "https://pt.vuejs.org/api/built-in-directives.html#v-on"
540
604
  }
541
605
  ]
542
606
  },
@@ -544,7 +608,7 @@
544
608
  "name": "v-bind",
545
609
  "description": {
546
610
  "kind": "markdown",
547
- "value": "\n动态的绑定一个或多个 attribute,也可以是组件的 prop。\n\n- **缩写:**`:` 或者 `.` (当使用 `.prop` 修饰符)\n\n- **期望:**`any (带参数) | Object (不带参数)`\n\n- **参数:**`attrOrProp (可选的)`\n\n- **修饰符**\n\n - `.camel` - 将短横线命名的 attribute 转变为驼峰式命名。\n - `.prop` - 强制绑定为 DOM property。<sup class=\"vt-badge\">3.2+</sup>\n - `.attr` - 强制绑定为 DOM attribute。<sup class=\"vt-badge\">3.2+</sup>\n\n- **用途**\n\n 当用于绑定 `class` 或 `style` attribute,`v-bind` 支持额外的值类型如数组或对象。详见下方的指南链接。\n\n 在处理绑定时,Vue 默认会利用 `in` 操作符来检查该元素上是否定义了和绑定的 key 同名的 DOM property。如果存在同名的 property,则 Vue 会把作为 DOM property 赋值,而不是作为 attribute 设置。这个行为在大多数情况都符合期望的绑定值类型,但是你也可以显式用 `.prop` 和 `.attr` 修饰符来强制绑定方式。有时这是必要的,特别是在和[自定义元素](https://cn.vuejs.org/guide/extras/web-components.html#passing-dom-properties)打交道时。\n\n 当用于组件 props 绑定时,所绑定的 props 必须在子组件中已被正确声明。\n\n 当不带参数使用时,可以用于绑定一个包含了多个 attribute 名称-绑定值对的对象。\n\n- **示例**\n\n ```html\n <!-- 绑定 attribute -->\n <img v-bind:src=\"imageSrc\" />\n\n <!-- 动态 attribute 名 -->\n <button v-bind:[key]=\"value\"></button>\n\n <!-- 缩写 -->\n <img :src=\"imageSrc\" />\n\n <!-- 缩写形式的动态 attribute 名 -->\n <button :[key]=\"value\"></button>\n\n <!-- 内联字符串拼接 -->\n <img :src=\"'/path/to/images/' + fileName\" />\n\n <!-- class 绑定 -->\n <div :class=\"{ red: isRed }\"></div>\n <div :class=\"[classA, classB]\"></div>\n <div :class=\"[classA, { classB: isB, classC: isC }]\"></div>\n\n <!-- style 绑定 -->\n <div :style=\"{ fontSize: size + 'px' }\"></div>\n <div :style=\"[styleObjectA, styleObjectB]\"></div>\n\n <!-- 绑定对象形式的 attribute -->\n <div v-bind=\"{ id: someProp, 'other-attr': otherProp }\"></div>\n\n <!-- prop 绑定。“prop” 必须在子组件中已声明。 -->\n <MyComponent :prop=\"someThing\" />\n\n <!-- 传递子父组件共有的 prop -->\n <MyComponent v-bind=\"$props\" />\n\n <!-- XLink -->\n <svg><a :xlink:special=\"foo\"></a></svg>\n ```\n\n `.prop` 修饰符也有专门的缩写,`.`:\n\n ```html\n <div :someProperty.prop=\"someObject\"></div>\n\n <!-- 等同于 -->\n <div .someProperty=\"someObject\"></div>\n ```\n\n 当在 DOM 内模板使用 `.camel` 修饰符,可以驼峰化 `v-bind` attribute 的名称,例如 SVG `viewBox` attribute:\n\n ```html\n <svg :view-box.camel=\"viewBox\"></svg>\n ```\n\n 如果使用字符串模板或使用构建步骤预编译模板,则不需要 `.camel`。\n\n- **参考**\n - [Class 与 Style 绑定](https://cn.vuejs.org/guide/essentials/class-and-style.html)\n - [组件 - Prop 传递细节](https://cn.vuejs.org/guide/components/props.html#prop-passing-details)\n"
611
+ "value": "\n动态的绑定一个或多个 attribute,也可以是组件的 prop。\n\n- **缩写:**`:` 或者 `.` (当使用 `.prop` 修饰符)\n\n- **期望:**`any (带参数) | Object (不带参数)`\n\n- **参数:**`attrOrProp (可选的)`\n\n- **修饰符**\n\n - `.camel` - 将短横线命名的 attribute 转变为驼峰式命名。\n - `.prop` - 强制绑定为 DOM property。<sup class=\"vt-badge\">3.2+</sup>\n - `.attr` - 强制绑定为 DOM attribute。<sup class=\"vt-badge\">3.2+</sup>\n\n- **用途**\n\n 当用于绑定 `class` 或 `style` attribute,`v-bind` 支持额外的值类型如数组或对象。详见下方的指南链接。\n\n 在处理绑定时,Vue 默认会利用 `in` 操作符来检查该元素上是否定义了和绑定的 key 同名的 DOM property。如果存在同名的 property,则 Vue 会将它作为 DOM property 赋值,而不是作为 attribute 设置。这个行为在大多数情况都符合期望的绑定值类型,但是你也可以显式用 `.prop` 和 `.attr` 修饰符来强制绑定方式。有时这是必要的,特别是在和[自定义元素](https://cn.vuejs.org/guide/extras/web-components.html#passing-dom-properties)打交道时。\n\n 当用于组件 props 绑定时,所绑定的 props 必须在子组件中已被正确声明。\n\n 当不带参数使用时,可以用于绑定一个包含了多个 attribute 名称-绑定值对的对象。\n\n- **示例**\n\n ```html\n <!-- 绑定 attribute -->\n <img v-bind:src=\"imageSrc\" />\n\n <!-- 动态 attribute 名 -->\n <button v-bind:[key]=\"value\"></button>\n\n <!-- 缩写 -->\n <img :src=\"imageSrc\" />\n\n <!-- 缩写形式的动态 attribute 名 -->\n <button :[key]=\"value\"></button>\n\n <!-- 内联字符串拼接 -->\n <img :src=\"'/path/to/images/' + fileName\" />\n\n <!-- class 绑定 -->\n <div :class=\"{ red: isRed }\"></div>\n <div :class=\"[classA, classB]\"></div>\n <div :class=\"[classA, { classB: isB, classC: isC }]\"></div>\n\n <!-- style 绑定 -->\n <div :style=\"{ fontSize: size + 'px' }\"></div>\n <div :style=\"[styleObjectA, styleObjectB]\"></div>\n\n <!-- 绑定对象形式的 attribute -->\n <div v-bind=\"{ id: someProp, 'other-attr': otherProp }\"></div>\n\n <!-- prop 绑定。“prop” 必须在子组件中已声明。 -->\n <MyComponent :prop=\"someThing\" />\n\n <!-- 传递子父组件共有的 prop -->\n <MyComponent v-bind=\"$props\" />\n\n <!-- XLink -->\n <svg><a :xlink:special=\"foo\"></a></svg>\n ```\n\n `.prop` 修饰符也有专门的缩写,`.`:\n\n ```html\n <div :someProperty.prop=\"someObject\"></div>\n\n <!-- 等同于 -->\n <div .someProperty=\"someObject\"></div>\n ```\n\n 当在 DOM 内模板使用 `.camel` 修饰符,可以驼峰化 `v-bind` attribute 的名称,例如 SVG `viewBox` attribute:\n\n ```html\n <svg :view-box.camel=\"viewBox\"></svg>\n ```\n\n 如果使用字符串模板或使用构建步骤预编译模板,则不需要 `.camel`。\n\n- **参考**\n - [Class 与 Style 绑定](https://cn.vuejs.org/guide/essentials/class-and-style.html)\n - [组件 - Prop 传递细节](https://cn.vuejs.org/guide/components/props.html#prop-passing-details)\n"
548
612
  },
549
613
  "references": [
550
614
  {
@@ -570,6 +634,10 @@
570
634
  {
571
635
  "name": "ko",
572
636
  "url": "https://ko.vuejs.org/api/built-in-directives.html#v-bind"
637
+ },
638
+ {
639
+ "name": "pt",
640
+ "url": "https://pt.vuejs.org/api/built-in-directives.html#v-bind"
573
641
  }
574
642
  ]
575
643
  },
@@ -603,6 +671,10 @@
603
671
  {
604
672
  "name": "ko",
605
673
  "url": "https://ko.vuejs.org/api/built-in-directives.html#v-model"
674
+ },
675
+ {
676
+ "name": "pt",
677
+ "url": "https://pt.vuejs.org/api/built-in-directives.html#v-model"
606
678
  }
607
679
  ]
608
680
  },
@@ -636,6 +708,10 @@
636
708
  {
637
709
  "name": "ko",
638
710
  "url": "https://ko.vuejs.org/api/built-in-directives.html#v-slot"
711
+ },
712
+ {
713
+ "name": "pt",
714
+ "url": "https://pt.vuejs.org/api/built-in-directives.html#v-slot"
639
715
  }
640
716
  ]
641
717
  },
@@ -669,6 +745,10 @@
669
745
  {
670
746
  "name": "ko",
671
747
  "url": "https://ko.vuejs.org/api/built-in-directives.html#v-pre"
748
+ },
749
+ {
750
+ "name": "pt",
751
+ "url": "https://pt.vuejs.org/api/built-in-directives.html#v-pre"
672
752
  }
673
753
  ]
674
754
  },
@@ -702,6 +782,10 @@
702
782
  {
703
783
  "name": "ko",
704
784
  "url": "https://ko.vuejs.org/api/built-in-directives.html#v-once"
785
+ },
786
+ {
787
+ "name": "pt",
788
+ "url": "https://pt.vuejs.org/api/built-in-directives.html#v-once"
705
789
  }
706
790
  ]
707
791
  },
@@ -735,6 +819,10 @@
735
819
  {
736
820
  "name": "ko",
737
821
  "url": "https://ko.vuejs.org/api/built-in-directives.html#v-memo"
822
+ },
823
+ {
824
+ "name": "pt",
825
+ "url": "https://pt.vuejs.org/api/built-in-directives.html#v-memo"
738
826
  }
739
827
  ]
740
828
  },
@@ -768,6 +856,10 @@
768
856
  {
769
857
  "name": "ko",
770
858
  "url": "https://ko.vuejs.org/api/built-in-directives.html#v-cloak"
859
+ },
860
+ {
861
+ "name": "pt",
862
+ "url": "https://pt.vuejs.org/api/built-in-directives.html#v-cloak"
771
863
  }
772
864
  ]
773
865
  },
@@ -801,6 +893,10 @@
801
893
  {
802
894
  "name": "ko",
803
895
  "url": "https://ko.vuejs.org/api/built-in-special-attributes.html#key"
896
+ },
897
+ {
898
+ "name": "pt",
899
+ "url": "https://pt.vuejs.org/api/built-in-special-attributes.html#key"
804
900
  }
805
901
  ]
806
902
  },
@@ -834,6 +930,10 @@
834
930
  {
835
931
  "name": "ko",
836
932
  "url": "https://ko.vuejs.org/api/built-in-special-attributes.html#ref"
933
+ },
934
+ {
935
+ "name": "pt",
936
+ "url": "https://pt.vuejs.org/api/built-in-special-attributes.html#ref"
837
937
  }
838
938
  ]
839
939
  },
@@ -867,6 +967,10 @@
867
967
  {
868
968
  "name": "ko",
869
969
  "url": "https://ko.vuejs.org/api/built-in-special-attributes.html#is"
970
+ },
971
+ {
972
+ "name": "pt",
973
+ "url": "https://pt.vuejs.org/api/built-in-special-attributes.html#is"
870
974
  }
871
975
  ]
872
976
  }
package/out/helpers.d.ts CHANGED
@@ -14,3 +14,4 @@ type Tags = Map<string, {
14
14
  }>;
15
15
  export declare function getTemplateTagsAndAttrs(sourceFile: embedded.VirtualFile): Tags;
16
16
  export {};
17
+ //# sourceMappingURL=helpers.d.ts.map
package/out/helpers.js CHANGED
@@ -1,8 +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 });
3
26
  exports.getTemplateTagsAndAttrs = exports.getElementAttrs = exports.getComponentNames = exports.getTemplateCtx = exports.getEventsOfTag = exports.getPropsByTag = void 0;
4
- const vue = require("@vue/language-core");
5
- const embedded = require("@volar/language-core");
27
+ const vue = __importStar(require("@vue/language-core"));
28
+ const embedded = __importStar(require("@volar/language-core"));
6
29
  const reactivity_1 = require("@vue/reactivity");
7
30
  const language_core_1 = require("@vue/language-core");
8
31
  const shared_1 = require("@vue/shared");
@@ -206,13 +229,13 @@ function getTemplateTagsAndAttrs(sourceFile) {
206
229
  for (const prop of node.props) {
207
230
  let name;
208
231
  let offset;
209
- if (prop.type === 7 /* CompilerDOM.NodeTypes.DIRECTIVE */
210
- && prop.arg?.type === 4 /* CompilerDOM.NodeTypes.SIMPLE_EXPRESSION */
232
+ if (prop.type === 7
233
+ && prop.arg?.type === 4
211
234
  && prop.arg.isStatic) {
212
235
  name = prop.arg.content;
213
236
  offset = prop.arg.loc.start.offset;
214
237
  }
215
- else if (prop.type === 6 /* CompilerDOM.NodeTypes.ATTRIBUTE */) {
238
+ else if (prop.type === 6) {
216
239
  name = prop.name;
217
240
  offset = prop.loc.start.offset;
218
241
  }
@@ -1,15 +1,16 @@
1
1
  import { ServiceContext } from '@volar/language-service';
2
- import * as vue from '@vue/language-core';
2
+ import { VueCompilerOptions } from '@vue/language-core';
3
+ import type { Provide } from 'volar-service-typescript';
3
4
  import type * as vscode from 'vscode-languageserver-protocol';
4
5
  import { AttrNameCasing, TagNameCasing } from '../types';
5
- import type { Provide } from 'volar-service-typescript';
6
- export declare function convertTagName(ts: typeof import('typescript/lib/tsserverlibrary'), context: ServiceContext<Provide>, uri: string, casing: TagNameCasing, vueCompilerOptions: vue.VueCompilerOptions): Promise<vscode.TextEdit[] | undefined>;
7
- export declare function convertAttrName(ts: typeof import('typescript/lib/tsserverlibrary'), context: ServiceContext, uri: string, casing: AttrNameCasing, vueCompilerOptions: vue.VueCompilerOptions): Promise<vscode.TextEdit[] | undefined>;
8
- export declare function getNameCasing(ts: typeof import('typescript/lib/tsserverlibrary'), context: ServiceContext, uri: string, vueCompilerOptions: vue.VueCompilerOptions): Promise<{
6
+ export declare function convertTagName(ts: typeof import('typescript/lib/tsserverlibrary'), context: ServiceContext<Provide>, uri: string, casing: TagNameCasing, vueCompilerOptions: VueCompilerOptions): Promise<vscode.TextEdit[] | undefined>;
7
+ export declare function convertAttrName(ts: typeof import('typescript/lib/tsserverlibrary'), context: ServiceContext, uri: string, casing: AttrNameCasing, vueCompilerOptions: VueCompilerOptions): Promise<vscode.TextEdit[] | undefined>;
8
+ export declare function getNameCasing(ts: typeof import('typescript/lib/tsserverlibrary'), context: ServiceContext, uri: string, vueCompilerOptions: VueCompilerOptions): Promise<{
9
9
  tag: TagNameCasing;
10
10
  attr: AttrNameCasing;
11
11
  }>;
12
- export declare function detect(ts: typeof import('typescript/lib/tsserverlibrary'), context: ServiceContext, uri: string, vueCompilerOptions: vue.VueCompilerOptions): {
12
+ export declare function detect(ts: typeof import('typescript/lib/tsserverlibrary'), context: ServiceContext, uri: string, vueCompilerOptions: VueCompilerOptions): {
13
13
  tag: TagNameCasing[];
14
14
  attr: AttrNameCasing[];
15
15
  };
16
+ //# sourceMappingURL=nameCasing.d.ts.map
@@ -1,13 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.detect = exports.getNameCasing = exports.convertAttrName = exports.convertTagName = void 0;
4
- const shared_1 = require("@vue/shared");
4
+ const language_core_1 = require("@vue/language-core");
5
5
  const helpers_1 = require("../helpers");
6
- const vue = require("@vue/language-core");
7
6
  const types_1 = require("../types");
8
7
  async function convertTagName(ts, context, uri, casing, vueCompilerOptions) {
9
8
  const rootFile = context.documents.getSourceByUri(uri)?.root;
10
- if (!(rootFile instanceof vue.VueFile))
9
+ if (!(rootFile instanceof language_core_1.VueFile))
11
10
  return;
12
11
  const desc = rootFile.sfc;
13
12
  if (!desc.template)
@@ -19,14 +18,14 @@ async function convertTagName(ts, context, uri, casing, vueCompilerOptions) {
19
18
  const components = (0, helpers_1.getComponentNames)(ts, languageService, rootFile, vueCompilerOptions);
20
19
  const tags = (0, helpers_1.getTemplateTagsAndAttrs)(rootFile);
21
20
  for (const [tagName, { offsets }] of tags) {
22
- const componentName = components.find(component => component === tagName || (0, shared_1.hyphenate)(component) === tagName);
21
+ const componentName = components.find(component => component === tagName || (0, language_core_1.hyphenateTag)(component) === tagName);
23
22
  if (componentName) {
24
23
  for (const offset of offsets) {
25
24
  const start = document.positionAt(template.startTagEnd + offset);
26
25
  const end = document.positionAt(template.startTagEnd + offset + tagName.length);
27
26
  const range = { start, end };
28
- if (casing === types_1.TagNameCasing.Kebab && tagName !== (0, shared_1.hyphenate)(componentName)) {
29
- edits.push({ range, newText: (0, shared_1.hyphenate)(componentName) });
27
+ if (casing === types_1.TagNameCasing.Kebab && tagName !== (0, language_core_1.hyphenateTag)(componentName)) {
28
+ edits.push({ range, newText: (0, language_core_1.hyphenateTag)(componentName) });
30
29
  }
31
30
  if (casing === types_1.TagNameCasing.Pascal && tagName !== componentName) {
32
31
  edits.push({ range, newText: componentName });
@@ -39,7 +38,7 @@ async function convertTagName(ts, context, uri, casing, vueCompilerOptions) {
39
38
  exports.convertTagName = convertTagName;
40
39
  async function convertAttrName(ts, context, uri, casing, vueCompilerOptions) {
41
40
  const rootFile = context.documents.getSourceByUri(uri)?.root;
42
- if (!(rootFile instanceof vue.VueFile))
41
+ if (!(rootFile instanceof language_core_1.VueFile))
43
42
  return;
44
43
  const desc = rootFile.sfc;
45
44
  if (!desc.template)
@@ -51,18 +50,18 @@ async function convertAttrName(ts, context, uri, casing, vueCompilerOptions) {
51
50
  const components = (0, helpers_1.getComponentNames)(ts, languageService, rootFile, vueCompilerOptions);
52
51
  const tags = (0, helpers_1.getTemplateTagsAndAttrs)(rootFile);
53
52
  for (const [tagName, { attrs }] of tags) {
54
- const componentName = components.find(component => component === tagName || (0, shared_1.hyphenate)(component) === tagName);
53
+ const componentName = components.find(component => component === tagName || (0, language_core_1.hyphenateTag)(component) === tagName);
55
54
  if (componentName) {
56
55
  const props = (0, helpers_1.getPropsByTag)(ts, languageService, rootFile, componentName, vueCompilerOptions);
57
56
  for (const [attrName, { offsets }] of attrs) {
58
- const propName = props.find(prop => prop === attrName || (0, shared_1.hyphenate)(prop) === attrName);
57
+ const propName = props.find(prop => prop === attrName || (0, language_core_1.hyphenateAttr)(prop) === attrName);
59
58
  if (propName) {
60
59
  for (const offset of offsets) {
61
60
  const start = document.positionAt(template.startTagEnd + offset);
62
61
  const end = document.positionAt(template.startTagEnd + offset + attrName.length);
63
62
  const range = { start, end };
64
- if (casing === types_1.AttrNameCasing.Kebab && attrName !== (0, shared_1.hyphenate)(propName)) {
65
- edits.push({ range, newText: (0, shared_1.hyphenate)(propName) });
63
+ if (casing === types_1.AttrNameCasing.Kebab && attrName !== (0, language_core_1.hyphenateAttr)(propName)) {
64
+ edits.push({ range, newText: (0, language_core_1.hyphenateAttr)(propName) });
66
65
  }
67
66
  if (casing === types_1.AttrNameCasing.Camel && attrName !== propName) {
68
67
  edits.push({ range, newText: propName });
@@ -91,7 +90,7 @@ async function getNameCasing(ts, context, uri, vueCompilerOptions) {
91
90
  exports.getNameCasing = getNameCasing;
92
91
  function detect(ts, context, uri, vueCompilerOptions) {
93
92
  const rootFile = context.documents.getSourceByUri(uri)?.root;
94
- if (!(rootFile instanceof vue.VueFile)) {
93
+ if (!(rootFile instanceof language_core_1.VueFile)) {
95
94
  return {
96
95
  tag: [],
97
96
  attr: [],
@@ -108,7 +107,7 @@ function detect(ts, context, uri, vueCompilerOptions) {
108
107
  for (const [_, { attrs }] of tags) {
109
108
  for (const [tagName] of attrs) {
110
109
  // attrName
111
- if (tagName !== (0, shared_1.hyphenate)(tagName)) {
110
+ if (tagName !== (0, language_core_1.hyphenateTag)(tagName)) {
112
111
  result.push(types_1.AttrNameCasing.Camel);
113
112
  break;
114
113
  }
@@ -129,7 +128,7 @@ function detect(ts, context, uri, vueCompilerOptions) {
129
128
  const result = [];
130
129
  let anyComponentUsed = false;
131
130
  for (const component of components) {
132
- if (tagNames.has(component) || tagNames.has((0, shared_1.hyphenate)(component))) {
131
+ if (tagNames.has(component) || tagNames.has((0, language_core_1.hyphenateTag)(component))) {
133
132
  anyComponentUsed = true;
134
133
  break;
135
134
  }
@@ -139,7 +138,7 @@ function detect(ts, context, uri, vueCompilerOptions) {
139
138
  }
140
139
  for (const [tagName] of tagNames) {
141
140
  // TagName
142
- if (tagName !== (0, shared_1.hyphenate)(tagName)) {
141
+ if (tagName !== (0, language_core_1.hyphenateTag)(tagName)) {
143
142
  result.push(types_1.TagNameCasing.Pascal);
144
143
  break;
145
144
  }
@@ -147,7 +146,7 @@ function detect(ts, context, uri, vueCompilerOptions) {
147
146
  for (const component of components) {
148
147
  // Tagname -> tagname
149
148
  // TagName -> tag-name
150
- if (component !== (0, shared_1.hyphenate)(component) && tagNames.has((0, shared_1.hyphenate)(component))) {
149
+ if (component !== (0, language_core_1.hyphenateTag)(component) && tagNames.has((0, language_core_1.hyphenateTag)(component))) {
151
150
  result.push(types_1.TagNameCasing.Kebab);
152
151
  break;
153
152
  }
package/out/index.d.ts CHANGED
@@ -4,3 +4,4 @@ export * from './ideFeatures/nameCasing';
4
4
  export * from './languageService';
5
5
  export { TagNameCasing, AttrNameCasing } from './types';
6
6
  export { Provide } from './plugins/vue';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -1,8 +1,9 @@
1
1
  import { Config } from '@volar/language-service';
2
- import * as vue from '@vue/language-core';
3
2
  import type * as ts from 'typescript/lib/tsserverlibrary';
4
- import createJsonService from 'volar-service-json';
3
+ import { VueCompilerOptions } from './types';
4
+ import * as JsonService from 'volar-service-json';
5
5
  export interface Settings {
6
- json?: Parameters<typeof createJsonService>[0];
6
+ json?: Parameters<typeof JsonService['create']>[0];
7
7
  }
8
- export declare function resolveConfig(config: Config, compilerOptions?: ts.CompilerOptions, vueCompilerOptions?: Partial<vue.VueCompilerOptions>, ts?: typeof import('typescript/lib/tsserverlibrary'), codegenStack?: boolean): Config;
8
+ export declare function resolveConfig(config: Config, compilerOptions?: ts.CompilerOptions, vueCompilerOptions?: Partial<VueCompilerOptions>, ts?: typeof import('typescript/lib/tsserverlibrary'), codegenStack?: boolean): Config;
9
+ //# sourceMappingURL=languageService.d.ts.map