@vue/language-service 2.1.10 → 2.2.2
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/data/language-blocks/cs.json +29 -930
- package/data/language-blocks/en.json +28 -929
- package/data/language-blocks/fr.json +28 -929
- package/data/language-blocks/it.json +28 -929
- package/data/language-blocks/ja.json +28 -929
- package/data/language-blocks/ko.json +28 -929
- package/data/language-blocks/pt.json +28 -929
- package/data/language-blocks/ru.json +28 -929
- package/data/language-blocks/zh-cn.json +30 -931
- package/data/language-blocks/zh-hk.json +28 -929
- package/data/locale.json +54 -0
- package/data/model-modifiers/cs.json +6 -165
- package/data/model-modifiers/en.json +6 -165
- package/data/model-modifiers/fr.json +6 -165
- package/data/model-modifiers/it.json +6 -165
- package/data/model-modifiers/ja.json +6 -165
- package/data/model-modifiers/ko.json +6 -165
- package/data/model-modifiers/pt.json +6 -165
- package/data/model-modifiers/ru.json +6 -165
- package/data/model-modifiers/zh-cn.json +6 -165
- package/data/model-modifiers/zh-hk.json +6 -165
- package/data/template/cs.json +59 -1429
- package/data/template/en.json +52 -1422
- package/data/template/fr.json +55 -1425
- package/data/template/it.json +49 -1427
- package/data/template/ja.json +53 -1423
- package/data/template/ko.json +44 -1422
- package/data/template/pt.json +44 -1422
- package/data/template/ru.json +52 -1422
- package/data/template/zh-cn.json +53 -1423
- package/data/template/zh-hk.json +44 -1422
- package/index.d.ts +2 -2
- package/index.js +14 -10
- package/lib/ideFeatures/nameCasing.js +15 -17
- package/lib/plugins/data.js +47 -20
- package/lib/plugins/utils.d.ts +3 -0
- package/lib/plugins/utils.js +14 -0
- package/lib/plugins/vue-autoinsert-dotvalue.d.ts +0 -9
- package/lib/plugins/vue-autoinsert-dotvalue.js +37 -53
- package/lib/plugins/vue-autoinsert-space.js +1 -1
- package/lib/plugins/vue-complete-define-assignment.js +14 -16
- package/lib/plugins/vue-directive-comments.js +10 -8
- package/lib/plugins/vue-document-drop.js +16 -13
- package/lib/plugins/vue-document-links.js +45 -39
- package/lib/plugins/vue-extract-file.d.ts +2 -1
- package/lib/plugins/vue-extract-file.js +29 -15
- package/lib/plugins/vue-inlayhints.d.ts +2 -2
- package/lib/plugins/vue-inlayhints.js +65 -56
- package/lib/plugins/vue-sfc.js +29 -27
- package/lib/plugins/vue-template.js +223 -201
- package/lib/plugins/vue-twoslash-queries.js +9 -4
- package/package.json +12 -11
- package/scripts/update-html-data.js +74 -70
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.create = create;
|
|
4
|
-
const
|
|
4
|
+
const language_core_1 = require("@vue/language-core");
|
|
5
5
|
const vscode_uri_1 = require("vscode-uri");
|
|
6
6
|
const twoslashReg = /<!--\s*\^\?\s*-->/g;
|
|
7
7
|
function create(getTsPluginClient) {
|
|
@@ -14,10 +14,15 @@ function create(getTsPluginClient) {
|
|
|
14
14
|
const tsPluginClient = getTsPluginClient?.(context);
|
|
15
15
|
return {
|
|
16
16
|
async provideInlayHints(document, range) {
|
|
17
|
-
const
|
|
17
|
+
const uri = vscode_uri_1.URI.parse(document.uri);
|
|
18
|
+
const decoded = context.decodeEmbeddedDocumentUri(uri);
|
|
18
19
|
const sourceScript = decoded && context.language.scripts.get(decoded[0]);
|
|
19
20
|
const virtualCode = decoded && sourceScript?.generated?.embeddedCodes.get(decoded[1]);
|
|
20
|
-
if (!
|
|
21
|
+
if (!sourceScript?.generated || virtualCode?.id !== 'template') {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const root = sourceScript.generated.root;
|
|
25
|
+
if (!(root instanceof language_core_1.VueVirtualCode)) {
|
|
21
26
|
return;
|
|
22
27
|
}
|
|
23
28
|
const hoverOffsets = [];
|
|
@@ -33,7 +38,7 @@ function create(getTsPluginClient) {
|
|
|
33
38
|
for (const [pointerPosition, hoverOffset] of hoverOffsets) {
|
|
34
39
|
const map = context.language.maps.get(virtualCode, sourceScript);
|
|
35
40
|
for (const [sourceOffset] of map.toSourceLocation(hoverOffset)) {
|
|
36
|
-
const quickInfo = await tsPluginClient?.getQuickInfoAtPosition(
|
|
41
|
+
const quickInfo = await tsPluginClient?.getQuickInfoAtPosition(root.fileName, sourceOffset);
|
|
37
42
|
if (quickInfo) {
|
|
38
43
|
inlayHints.push({
|
|
39
44
|
position: { line: pointerPosition.line, character: pointerPosition.character + 2 },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/language-service",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"files": [
|
|
6
6
|
"data",
|
|
@@ -17,14 +17,14 @@
|
|
|
17
17
|
"update-html-data": "node ./scripts/update-html-data.js"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@volar/language-core": "~2.4.
|
|
21
|
-
"@volar/language-service": "~2.4.
|
|
22
|
-
"@volar/typescript": "~2.4.
|
|
20
|
+
"@volar/language-core": "~2.4.11",
|
|
21
|
+
"@volar/language-service": "~2.4.11",
|
|
22
|
+
"@volar/typescript": "~2.4.11",
|
|
23
23
|
"@vue/compiler-dom": "^3.5.0",
|
|
24
|
-
"@vue/language-core": "2.
|
|
24
|
+
"@vue/language-core": "2.2.2",
|
|
25
25
|
"@vue/shared": "^3.5.0",
|
|
26
|
-
"@vue/typescript-plugin": "2.
|
|
27
|
-
"alien-signals": "^0.
|
|
26
|
+
"@vue/typescript-plugin": "2.2.2",
|
|
27
|
+
"alien-signals": "^1.0.3",
|
|
28
28
|
"path-browserify": "^1.0.1",
|
|
29
29
|
"volar-service-css": "0.0.62",
|
|
30
30
|
"volar-service-emmet": "0.0.62",
|
|
@@ -39,9 +39,10 @@
|
|
|
39
39
|
"vscode-uri": "^3.0.8"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@types/node": "
|
|
43
|
-
"@types/path-browserify": "
|
|
44
|
-
"@volar/kit": "~2.4.
|
|
42
|
+
"@types/node": "^22.10.4",
|
|
43
|
+
"@types/path-browserify": "^1.0.1",
|
|
44
|
+
"@volar/kit": "~2.4.11",
|
|
45
45
|
"vscode-languageserver-protocol": "^3.17.5"
|
|
46
|
-
}
|
|
46
|
+
},
|
|
47
|
+
"gitHead": "30757908b67f40f779c36795665163634fb81868"
|
|
47
48
|
}
|
|
@@ -84,12 +84,22 @@ const langs = [
|
|
|
84
84
|
|
|
85
85
|
for (const lang of langs) {
|
|
86
86
|
if (lang.supported) {
|
|
87
|
+
localeWorker(lang);
|
|
87
88
|
templateWorker(lang);
|
|
88
89
|
sfcWorker(lang);
|
|
89
90
|
modelWorker(lang);
|
|
90
91
|
}
|
|
91
92
|
}
|
|
92
93
|
|
|
94
|
+
function localeWorker(lang) {
|
|
95
|
+
|
|
96
|
+
const data = langs.map(({ name, url }) => ({ name, url }));
|
|
97
|
+
|
|
98
|
+
const writePath = path.resolve(__dirname, '../data/locale.json');
|
|
99
|
+
fs.writeFileSync(writePath, JSON.stringify(data, null, 2));
|
|
100
|
+
console.log(writePath);
|
|
101
|
+
}
|
|
102
|
+
|
|
93
103
|
async function sfcWorker(lang) {
|
|
94
104
|
|
|
95
105
|
const sfcDoc = await fetchText(lang.repoUrl + 'HEAD/src/api/sfc-spec.md', lang.url);
|
|
@@ -102,7 +112,7 @@ async function sfcWorker(lang) {
|
|
|
102
112
|
name: 'lang',
|
|
103
113
|
description: {
|
|
104
114
|
kind: 'markdown',
|
|
105
|
-
value: sfcDoc.split('\n## ')[4].split('\n').slice(1).join('\n'),
|
|
115
|
+
value: sfcDoc.split('\n## ')[4].split('\n').slice(1).join('\n').trim(),
|
|
106
116
|
},
|
|
107
117
|
values: [
|
|
108
118
|
// // custom block
|
|
@@ -115,10 +125,7 @@ async function sfcWorker(lang) {
|
|
|
115
125
|
// { name: 'gql' },
|
|
116
126
|
// { name: 'graphql' },
|
|
117
127
|
],
|
|
118
|
-
references:
|
|
119
|
-
name: lang.name,
|
|
120
|
-
url: `${lang.url}api/sfc-spec.html#pre-processors`,
|
|
121
|
-
})),
|
|
128
|
+
references: 'api/sfc-spec.html#pre-processors',
|
|
122
129
|
};
|
|
123
130
|
/**
|
|
124
131
|
* @type {import('vscode-html-languageservice').IAttributeData}
|
|
@@ -127,12 +134,9 @@ async function sfcWorker(lang) {
|
|
|
127
134
|
name: 'src',
|
|
128
135
|
description: {
|
|
129
136
|
kind: 'markdown',
|
|
130
|
-
value: sfcDoc.split('\n## ')[5].split('\n').slice(1).join('\n'),
|
|
137
|
+
value: sfcDoc.split('\n## ')[5].split('\n').slice(1).join('\n').trim(),
|
|
131
138
|
},
|
|
132
|
-
references:
|
|
133
|
-
name: lang.name,
|
|
134
|
-
url: `${lang.url}api/sfc-spec.html#src-imports`,
|
|
135
|
-
})),
|
|
139
|
+
references: 'api/sfc-spec.html#src-imports',
|
|
136
140
|
};
|
|
137
141
|
const languageBlocks = sfcDoc
|
|
138
142
|
.split('\n## ')[2]
|
|
@@ -151,10 +155,7 @@ async function sfcWorker(lang) {
|
|
|
151
155
|
kind: 'markdown',
|
|
152
156
|
value: lines.slice(1).join('\n'),
|
|
153
157
|
},
|
|
154
|
-
references:
|
|
155
|
-
name: lang.name,
|
|
156
|
-
url: `${lang.url}api/sfc-spec.html#${normalizeHash(name)}`,
|
|
157
|
-
})),
|
|
158
|
+
references: `api/sfc-spec.html#${normalizeHash(name)}`,
|
|
158
159
|
};
|
|
159
160
|
if (name === 'template') {
|
|
160
161
|
data.attributes.push({
|
|
@@ -194,24 +195,18 @@ async function sfcWorker(lang) {
|
|
|
194
195
|
valueSet: 'v',
|
|
195
196
|
description: {
|
|
196
197
|
kind: 'markdown',
|
|
197
|
-
value: cssFeaturesDoc.split('\n## ')[1].split('\n').slice(1).join('\n'),
|
|
198
|
+
value: cssFeaturesDoc.split('\n## ')[1].split('\n').slice(1).join('\n').trim(),
|
|
198
199
|
},
|
|
199
|
-
references:
|
|
200
|
-
name: lang.name,
|
|
201
|
-
url: `${lang.url}api/sfc-css-features.html#scoped-css`,
|
|
202
|
-
})),
|
|
200
|
+
references: 'api/sfc-css-features.html#scoped-css',
|
|
203
201
|
});
|
|
204
202
|
data.attributes.push({
|
|
205
203
|
name: 'module',
|
|
206
204
|
valueSet: 'v',
|
|
207
205
|
description: {
|
|
208
206
|
kind: 'markdown',
|
|
209
|
-
value: cssFeaturesDoc.split('\n## ')[2].split('\n').slice(1).join('\n'),
|
|
207
|
+
value: cssFeaturesDoc.split('\n## ')[2].split('\n').slice(1).join('\n').trim(),
|
|
210
208
|
},
|
|
211
|
-
references:
|
|
212
|
-
name: lang.name,
|
|
213
|
-
url: `${lang.url}api/sfc-css-features.html#css-modules`,
|
|
214
|
-
})),
|
|
209
|
+
references: 'api/sfc-css-features.html#css-modules',
|
|
215
210
|
});
|
|
216
211
|
}
|
|
217
212
|
return data;
|
|
@@ -263,12 +258,9 @@ async function modelWorker(lang) {
|
|
|
263
258
|
name,
|
|
264
259
|
description: {
|
|
265
260
|
kind: 'markdown',
|
|
266
|
-
value: lines.slice(1).join('\n'),
|
|
261
|
+
value: lines.slice(1).join('\n').trim(),
|
|
267
262
|
},
|
|
268
|
-
references:
|
|
269
|
-
name: lang.name,
|
|
270
|
-
url: `${lang.url}guide/essentials/forms.html#${normalizeHash(name)}`,
|
|
271
|
-
})),
|
|
263
|
+
references: `guide/essentials/forms.html#${normalizeHash(name)}`,
|
|
272
264
|
};
|
|
273
265
|
return data;
|
|
274
266
|
});
|
|
@@ -288,47 +280,40 @@ async function modelWorker(lang) {
|
|
|
288
280
|
|
|
289
281
|
async function templateWorker(lang) {
|
|
290
282
|
|
|
291
|
-
const directivesDoc = await fetchText(lang.repoUrl + 'HEAD/src/api/built-in-directives.md', lang.url);
|
|
292
|
-
const attributesDoc = await fetchText(lang.repoUrl + 'HEAD/src/api/built-in-special-attributes.md', lang.url);
|
|
293
283
|
const componentsDoc = await fetchText(lang.repoUrl + 'HEAD/src/api/built-in-components.md', lang.url);
|
|
294
284
|
const elementsDoc = await fetchText(lang.repoUrl + 'HEAD/src/api/built-in-special-elements.md', lang.url);
|
|
285
|
+
const directivesDoc = await fetchText(lang.repoUrl + 'HEAD/src/api/built-in-directives.md', lang.url);
|
|
286
|
+
const attributesDoc = await fetchText(lang.repoUrl + 'HEAD/src/api/built-in-special-attributes.md', lang.url);
|
|
287
|
+
const ssrDoc = await fetchText(lang.repoUrl + 'HEAD/src/api/ssr.md', lang.url);
|
|
295
288
|
|
|
296
|
-
const
|
|
289
|
+
const components = componentsDoc
|
|
297
290
|
.split('\n## ')
|
|
298
291
|
.slice(1)
|
|
299
292
|
.map((section) => {
|
|
300
293
|
const lines = section.split('\n');
|
|
301
|
-
const name =
|
|
294
|
+
const name = normalizeTagName(lines[0]);
|
|
302
295
|
/**
|
|
303
|
-
* @type {import('vscode-html-languageservice').
|
|
296
|
+
* @type {import('vscode-html-languageservice').ITagData}
|
|
304
297
|
*/
|
|
305
298
|
const data = {
|
|
306
299
|
name,
|
|
307
|
-
valueSet:
|
|
308
|
-
name === 'v-cloak' ||
|
|
309
|
-
name === 'v-else' ||
|
|
310
|
-
name === 'v-once' ||
|
|
311
|
-
name === 'v-pre'
|
|
312
|
-
? 'v' : undefined,
|
|
313
300
|
description: {
|
|
314
301
|
kind: 'markdown',
|
|
315
302
|
value: lines.slice(1).join('\n'),
|
|
316
303
|
},
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
url: `${lang.url}api/built-in-directives.html#${normalizeHash(name)}`,
|
|
320
|
-
})),
|
|
304
|
+
attributes: [],
|
|
305
|
+
references: `api/built-in-components.html#${normalizeHash(name)}`,
|
|
321
306
|
};
|
|
322
307
|
return data;
|
|
323
308
|
});
|
|
324
|
-
const
|
|
309
|
+
const elements = elementsDoc
|
|
325
310
|
.split('\n## ')
|
|
326
311
|
.slice(1)
|
|
327
312
|
.map((section) => {
|
|
328
313
|
const lines = section.split('\n');
|
|
329
|
-
const name =
|
|
314
|
+
const name = normalizeTagName(lines[0]);
|
|
330
315
|
/**
|
|
331
|
-
* @type {import('vscode-html-languageservice').
|
|
316
|
+
* @type {import('vscode-html-languageservice').ITagData}
|
|
332
317
|
*/
|
|
333
318
|
const data = {
|
|
334
319
|
name,
|
|
@@ -336,59 +321,78 @@ async function templateWorker(lang) {
|
|
|
336
321
|
kind: 'markdown',
|
|
337
322
|
value: lines.slice(1).join('\n'),
|
|
338
323
|
},
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
url: `${lang.url}api/built-in-special-attributes.html#${normalizeHash(name)}`,
|
|
342
|
-
})),
|
|
324
|
+
attributes: [],
|
|
325
|
+
references: `api/built-in-special-elements.html#${normalizeHash(name)}`,
|
|
343
326
|
};
|
|
344
327
|
return data;
|
|
345
328
|
});
|
|
346
|
-
const
|
|
329
|
+
const directives = directivesDoc
|
|
347
330
|
.split('\n## ')
|
|
348
331
|
.slice(1)
|
|
349
332
|
.map((section) => {
|
|
350
333
|
const lines = section.split('\n');
|
|
351
|
-
const name =
|
|
334
|
+
const name = normalizeAttrName(lines[0]);
|
|
352
335
|
/**
|
|
353
|
-
* @type {import('vscode-html-languageservice').
|
|
336
|
+
* @type {import('vscode-html-languageservice').IAttributeData}
|
|
354
337
|
*/
|
|
355
338
|
const data = {
|
|
356
339
|
name,
|
|
340
|
+
valueSet:
|
|
341
|
+
name === 'v-cloak' ||
|
|
342
|
+
name === 'v-else' ||
|
|
343
|
+
name === 'v-once' ||
|
|
344
|
+
name === 'v-pre'
|
|
345
|
+
? 'v' : undefined,
|
|
357
346
|
description: {
|
|
358
347
|
kind: 'markdown',
|
|
359
|
-
value: lines.slice(1).join('\n'),
|
|
348
|
+
value: lines.slice(1).join('\n').trim(),
|
|
360
349
|
},
|
|
361
|
-
|
|
362
|
-
references: langs.map(lang => ({
|
|
363
|
-
name: lang.name,
|
|
364
|
-
url: `${lang.url}api/built-in-components.html#${normalizeHash(name)}`,
|
|
365
|
-
})),
|
|
350
|
+
references: `api/built-in-directives.html#${normalizeHash(name)}`,
|
|
366
351
|
};
|
|
367
352
|
return data;
|
|
368
353
|
});
|
|
369
|
-
const
|
|
354
|
+
const attributes = attributesDoc
|
|
370
355
|
.split('\n## ')
|
|
371
356
|
.slice(1)
|
|
372
357
|
.map((section) => {
|
|
373
358
|
const lines = section.split('\n');
|
|
374
|
-
const name =
|
|
359
|
+
const name = normalizeAttrName(lines[0]);
|
|
375
360
|
/**
|
|
376
|
-
* @type {import('vscode-html-languageservice').
|
|
361
|
+
* @type {import('vscode-html-languageservice').IAttributeData}
|
|
377
362
|
*/
|
|
378
363
|
const data = {
|
|
379
364
|
name,
|
|
380
365
|
description: {
|
|
381
366
|
kind: 'markdown',
|
|
382
|
-
value: lines.slice(1).join('\n'),
|
|
367
|
+
value: lines.slice(1).join('\n').trim(),
|
|
383
368
|
},
|
|
384
|
-
|
|
385
|
-
references: langs.map(lang => ({
|
|
386
|
-
name: lang.name,
|
|
387
|
-
url: `${lang.url}api/built-in-special-elements.html#${normalizeHash(name)}`,
|
|
388
|
-
})),
|
|
369
|
+
references: `api/built-in-special-attributes.html#${normalizeHash(name)}`,
|
|
389
370
|
};
|
|
390
371
|
return data;
|
|
391
372
|
});
|
|
373
|
+
const dataAllowMismatch = ssrDoc
|
|
374
|
+
.split(/## data-allow-mismatch.*\n/)
|
|
375
|
+
.slice(1)
|
|
376
|
+
.map((section) => {
|
|
377
|
+
const lines = section.split('\n');
|
|
378
|
+
const name = 'data-allow-mismatch';
|
|
379
|
+
/**
|
|
380
|
+
* @type {import('vscode-html-languageservice').IAttributeData}
|
|
381
|
+
*/
|
|
382
|
+
const data = {
|
|
383
|
+
name,
|
|
384
|
+
description: {
|
|
385
|
+
kind: 'markdown',
|
|
386
|
+
value: lines.slice(1).join('\n'),
|
|
387
|
+
},
|
|
388
|
+
references: `api/ssr.html#${normalizeHash(name)}`,
|
|
389
|
+
};
|
|
390
|
+
return data;
|
|
391
|
+
})[0];
|
|
392
|
+
|
|
393
|
+
if (dataAllowMismatch) {
|
|
394
|
+
attributes.push(dataAllowMismatch);
|
|
395
|
+
}
|
|
392
396
|
|
|
393
397
|
/**
|
|
394
398
|
* @type {import('vscode-html-languageservice').HTMLDataV1}
|
|
@@ -401,7 +405,7 @@ async function templateWorker(lang) {
|
|
|
401
405
|
],
|
|
402
406
|
globalAttributes: [
|
|
403
407
|
...directives,
|
|
404
|
-
...attributes
|
|
408
|
+
...attributes,
|
|
405
409
|
],
|
|
406
410
|
};
|
|
407
411
|
|