@vue/language-service 3.0.0-alpha.2 → 3.0.0-alpha.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.
package/index.d.ts CHANGED
@@ -3,7 +3,7 @@ export * from '@vue/language-core';
3
3
  export * from './lib/nameCasing';
4
4
  export * from './lib/types';
5
5
  import type { LanguageServicePlugin } from '@volar/language-service';
6
- import { VueCompilerOptions } from '@vue/language-core';
6
+ import { type VueCompilerOptions } from '@vue/language-core';
7
7
  declare module '@volar/language-service' {
8
8
  interface ProjectContext {
9
9
  vue?: {
@@ -17,7 +17,7 @@ async function convertTagName(context, uri, casing, tsPluginClient) {
17
17
  if (!(root instanceof language_core_1.VueVirtualCode)) {
18
18
  return;
19
19
  }
20
- const { template } = root._sfc;
20
+ const { template } = root.sfc;
21
21
  if (!template) {
22
22
  return;
23
23
  }
@@ -52,7 +52,7 @@ async function convertAttrName(context, uri, casing, tsPluginClient) {
52
52
  if (!(root instanceof language_core_1.VueVirtualCode)) {
53
53
  return;
54
54
  }
55
- const { template } = root._sfc;
55
+ const { template } = root.sfc;
56
56
  if (!template) {
57
57
  return;
58
58
  }
@@ -132,8 +132,8 @@ async function detect(context, uri) {
132
132
  }
133
133
  function getTagNameCase(file) {
134
134
  const result = new Set();
135
- if (file._sfc.template?.ast) {
136
- for (const element of vue.forEachElementNode(file._sfc.template.ast)) {
135
+ if (file.sfc.template?.ast) {
136
+ for (const element of vue.forEachElementNode(file.sfc.template.ast)) {
137
137
  if (element.tagType === 1) {
138
138
  if (element.tag !== (0, language_core_1.hyphenateTag)(element.tag)) {
139
139
  // TagName
@@ -157,7 +157,7 @@ function getTemplateTagsAndAttrs(sourceFile) {
157
157
  if (!(sourceFile instanceof vue.VueVirtualCode)) {
158
158
  return;
159
159
  }
160
- const ast = sourceFile._sfc.template?.ast;
160
+ const ast = sourceFile.sfc.template?.ast;
161
161
  const tags = new Map();
162
162
  if (ast) {
163
163
  for (const node of vue.forEachElementNode(ast)) {
@@ -197,6 +197,6 @@ function getTemplateTagsAndAttrs(sourceFile) {
197
197
  });
198
198
  map.set(sourceFile, getter);
199
199
  }
200
- return map.get(sourceFile).get() ?? new Map();
200
+ return map.get(sourceFile)() ?? new Map();
201
201
  }
202
202
  //# sourceMappingURL=nameCasing.js.map
@@ -1,2 +1,2 @@
1
- import { LanguageServicePlugin } from '../types';
1
+ import type { LanguageServicePlugin } from '../types';
2
2
  export declare function create(): LanguageServicePlugin;
@@ -1,2 +1,2 @@
1
- import { LanguageServiceContext, LanguageServicePlugin } from '../types';
1
+ import { type LanguageServiceContext, type LanguageServicePlugin } from '../types';
2
2
  export declare function create(ts: typeof import('typescript'), getTsPluginClient?: (context: LanguageServiceContext) => import('@vue/typescript-plugin/lib/requests').Requests | undefined): LanguageServicePlugin;
@@ -1,5 +1,5 @@
1
1
  import type { LanguageServiceContext, LanguageServicePlugin } from '@volar/language-service';
2
- import { Sfc } from '@vue/language-core';
2
+ import { type Sfc } from '@vue/language-core';
3
3
  import type * as ts from 'typescript';
4
4
  export declare function create(ts: typeof import('typescript'), getTsPluginClient?: (context: LanguageServiceContext) => import('@vue/typescript-plugin/lib/requests').Requests | undefined): LanguageServicePlugin;
5
5
  export declare function getLastImportNode(ts: typeof import('typescript'), sourceFile: ts.SourceFile): ts.Node | undefined;
@@ -1,3 +1,3 @@
1
1
  import type { LanguageServiceContext } from '@volar/language-service';
2
- import { LanguageServicePlugin } from '../types';
2
+ import { type LanguageServicePlugin } from '../types';
3
3
  export declare function create(getTsPluginClient?: (context: LanguageServiceContext) => import('@vue/typescript-plugin/lib/requests').Requests | undefined): LanguageServicePlugin;
@@ -193,7 +193,9 @@ function create() {
193
193
  if (!result) {
194
194
  return;
195
195
  }
196
- result.items = result.items.filter(item => item.label !== '!DOCTYPE' && item.label !== 'Custom Blocks');
196
+ result.items = result.items.filter(item => item.label !== '!DOCTYPE' &&
197
+ item.label !== 'Custom Blocks' &&
198
+ item.label !== 'data-');
197
199
  const tags = sfcDataProvider?.provideTags();
198
200
  const scriptLangs = getLangs('script');
199
201
  const scriptItems = result.items.filter(item => item.label === 'script' || item.label === 'script setup');
@@ -1,3 +1,3 @@
1
1
  import type { LanguageServiceContext } from '@volar/language-service';
2
- import { LanguageServicePlugin } from '../types';
2
+ import { type LanguageServicePlugin } from '../types';
3
3
  export declare function create(mode: 'html' | 'pug', getTsPluginClient?: (context: LanguageServiceContext) => import('@vue/typescript-plugin/lib/requests').Requests | undefined): LanguageServicePlugin;
@@ -247,14 +247,19 @@ function create(mode, getTsPluginClient) {
247
247
  return [];
248
248
  }
249
249
  const { attrs, propInfos, events, directives } = tagInfo;
250
- const props = propInfos.map(prop => (0, language_core_1.hyphenateTag)(prop.name).startsWith('on-vnode-')
251
- ? 'onVue:' + prop.name.slice('onVnode'.length)
252
- : prop.name);
250
+ for (const prop of propInfos) {
251
+ if ((0, language_core_1.hyphenateTag)(prop.name).startsWith('on-vnode-')) {
252
+ prop.name = 'onVue:' + prop.name.slice('onVnode'.length);
253
+ }
254
+ }
253
255
  const attributes = [];
254
- const propsSet = new Set(props);
255
- for (const prop of [...props, ...attrs]) {
256
- const isGlobal = !propsSet.has(prop);
257
- const name = casing.attr === types_1.AttrNameCasing.Camel ? prop : (0, language_core_1.hyphenateAttr)(prop);
256
+ const propsSet = new Set(propInfos.map(prop => prop.name));
257
+ for (const prop of [
258
+ ...propInfos,
259
+ ...attrs.map(attr => ({ name: attr })),
260
+ ]) {
261
+ const isGlobal = prop.isAttribute || !propsSet.has(prop.name);
262
+ const name = casing.attr === types_1.AttrNameCasing.Camel ? prop.name : (0, language_core_1.hyphenateAttr)(prop.name);
258
263
  const isEvent = (0, language_core_1.hyphenateAttr)(name).startsWith('on-');
259
264
  if (isEvent) {
260
265
  const propNameBase = name.startsWith('on-')
@@ -282,6 +287,7 @@ function create(mode, getTsPluginClient) {
282
287
  attributes.push({
283
288
  name: propName,
284
289
  description: propKey,
290
+ valueSet: prop.values?.some(value => typeof value === 'string') ? '__deferred__' : undefined,
285
291
  }, {
286
292
  name: ':' + propName,
287
293
  description: propKey,
@@ -309,10 +315,13 @@ function create(mode, getTsPluginClient) {
309
315
  });
310
316
  }
311
317
  const models = [];
312
- for (const prop of [...props, ...attrs]) {
313
- if (prop.startsWith('onUpdate:')) {
314
- const isGlobal = !propsSet.has(prop);
315
- models.push([isGlobal, prop.slice('onUpdate:'.length)]);
318
+ for (const prop of [
319
+ ...propInfos,
320
+ ...attrs.map(attr => ({ name: attr })),
321
+ ]) {
322
+ if (prop.name.startsWith('onUpdate:')) {
323
+ const isGlobal = !propsSet.has(prop.name);
324
+ models.push([isGlobal, prop.name.slice('onUpdate:'.length)]);
316
325
  }
317
326
  }
318
327
  for (const event of events) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/language-service",
3
- "version": "3.0.0-alpha.2",
3
+ "version": "3.0.0-alpha.6",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "data",
@@ -17,23 +17,23 @@
17
17
  "update-html-data": "node ./scripts/update-html-data.js"
18
18
  },
19
19
  "dependencies": {
20
- "@volar/language-core": "~2.4.11",
21
- "@volar/language-service": "~2.4.11",
22
- "@volar/typescript": "~2.4.11",
20
+ "@volar/language-core": "~2.4.13",
21
+ "@volar/language-service": "~2.4.13",
22
+ "@volar/typescript": "~2.4.13",
23
23
  "@vue/compiler-dom": "^3.5.0",
24
- "@vue/language-core": "3.0.0-alpha.2",
24
+ "@vue/language-core": "3.0.0-alpha.6",
25
25
  "@vue/shared": "^3.5.0",
26
- "@vue/typescript-plugin": "3.0.0-alpha.2",
26
+ "@vue/typescript-plugin": "3.0.0-alpha.6",
27
27
  "alien-signals": "^1.0.3",
28
28
  "path-browserify": "^1.0.1",
29
- "volar-service-css": "0.0.62",
30
- "volar-service-emmet": "0.0.62",
31
- "volar-service-html": "0.0.62",
32
- "volar-service-json": "0.0.62",
33
- "volar-service-pug": "0.0.62",
34
- "volar-service-pug-beautify": "0.0.62",
35
- "volar-service-typescript": "0.0.62",
36
- "volar-service-typescript-twoslash-queries": "0.0.62",
29
+ "volar-service-css": "0.0.64",
30
+ "volar-service-emmet": "0.0.64",
31
+ "volar-service-html": "0.0.64",
32
+ "volar-service-json": "0.0.64",
33
+ "volar-service-pug": "0.0.64",
34
+ "volar-service-pug-beautify": "0.0.64",
35
+ "volar-service-typescript": "0.0.64",
36
+ "volar-service-typescript-twoslash-queries": "0.0.64",
37
37
  "vscode-css-languageservice": "^6.3.1",
38
38
  "vscode-html-languageservice": "^5.2.0",
39
39
  "vscode-languageserver-textdocument": "^1.0.11",
@@ -42,8 +42,8 @@
42
42
  "devDependencies": {
43
43
  "@types/node": "^22.10.4",
44
44
  "@types/path-browserify": "^1.0.1",
45
- "@volar/kit": "~2.4.11",
45
+ "@volar/kit": "~2.4.13",
46
46
  "vscode-languageserver-protocol": "^3.17.5"
47
47
  },
48
- "gitHead": "79247b7c24b7202ec676723440fdb36c38e6d450"
48
+ "gitHead": "a7b5649ab4957cd2228f4bbc9205b2008bff58a2"
49
49
  }
@@ -1,2 +0,0 @@
1
- import type { LanguageServicePlugin } from '@volar/language-service';
2
- export declare function create(): LanguageServicePlugin;
@@ -1,33 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.create = create;
4
- function create() {
5
- return {
6
- name: 'vue-autoinsert-selfClosing',
7
- capabilities: {
8
- autoInsertionProvider: {
9
- triggerCharacters: ['/'],
10
- configurationSections: ['vue.autoInsert.selfClosing'],
11
- },
12
- },
13
- create(context) {
14
- return {
15
- async provideAutoInsertSnippet(document, selection, change) {
16
- if (document.languageId !== 'html') {
17
- return;
18
- }
19
- const enabled = await context.env.getConfiguration?.('vue.autoInsert.selfClosing') ?? true;
20
- if (!enabled) {
21
- return;
22
- }
23
- if (change.text === '{}'
24
- && document.getText().slice(change.rangeOffset - 1, change.rangeOffset + 3) === '{{}}'
25
- && document.offsetAt(selection) === change.rangeOffset + 1) {
26
- return ` $0 `;
27
- }
28
- },
29
- };
30
- },
31
- };
32
- }
33
- //# sourceMappingURL=vue-autoinsert-self-closing.js.map