@vue/language-service 2.0.13 → 2.0.15
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 +1034 -0
- package/data/language-blocks/en.json +204 -0
- package/data/language-blocks/fr.json +204 -0
- package/data/language-blocks/it.json +204 -0
- package/data/language-blocks/ja.json +204 -0
- package/data/language-blocks/ko.json +205 -1
- package/data/language-blocks/pt.json +204 -0
- package/data/language-blocks/ru.json +1034 -0
- package/data/language-blocks/zh-cn.json +205 -1
- package/data/model-modifiers/cs.json +176 -0
- package/data/model-modifiers/en.json +36 -0
- package/data/model-modifiers/fr.json +36 -0
- package/data/model-modifiers/it.json +36 -0
- package/data/model-modifiers/ja.json +36 -0
- package/data/model-modifiers/ko.json +36 -0
- package/data/model-modifiers/pt.json +36 -0
- package/data/model-modifiers/ru.json +176 -0
- package/data/model-modifiers/zh-cn.json +36 -0
- package/data/template/cs.json +1498 -0
- package/data/template/en.json +313 -1
- package/data/template/fr.json +315 -3
- package/data/template/it.json +312 -0
- package/data/template/ja.json +313 -1
- package/data/template/ko.json +316 -4
- package/data/template/pt.json +312 -0
- package/data/template/ru.json +1498 -0
- package/data/template/zh-cn.json +312 -0
- package/index.d.ts +1 -1
- package/index.js +3 -3
- package/lib/ideFeatures/nameCasing.d.ts +2 -2
- package/lib/ideFeatures/nameCasing.js +22 -34
- package/lib/plugins/data.js +18 -0
- package/lib/plugins/vue-codelens-references.js +1 -1
- package/lib/plugins/vue-document-drop.js +1 -1
- package/lib/plugins/vue-extract-file.js +2 -2
- package/lib/plugins/vue-sfc.d.ts +1 -1
- package/lib/plugins/vue-sfc.js +2 -2
- package/lib/plugins/vue-template.js +16 -15
- package/lib/plugins/vue-toggle-v-bind-codeaction.js +1 -1
- package/lib/plugins/vue-twoslash-queries.js +1 -1
- package/package.json +17 -17
- package/scripts/update-html-data.js +18 -0
|
@@ -30,7 +30,7 @@ function create() {
|
|
|
30
30
|
const decoded = context.decodeEmbeddedDocumentUri(uri);
|
|
31
31
|
const sourceScript = decoded && context.language.scripts.get(decoded[0]);
|
|
32
32
|
const virtualCode = decoded && sourceScript?.generated?.embeddedCodes.get(decoded[1]);
|
|
33
|
-
if (!virtualCode || !(sourceScript?.generated?.root instanceof language_core_1.
|
|
33
|
+
if (!virtualCode || !(sourceScript?.generated?.root instanceof language_core_1.VueVirtualCode) || !sourceScript) {
|
|
34
34
|
return;
|
|
35
35
|
}
|
|
36
36
|
return callback(virtualCode, sourceScript);
|
|
@@ -22,7 +22,7 @@ function create(ts, getTsPluginClient) {
|
|
|
22
22
|
const sourceScript = decoded && context.language.scripts.get(decoded[0]);
|
|
23
23
|
const virtualCode = decoded && sourceScript?.generated?.embeddedCodes.get(decoded[1]);
|
|
24
24
|
const vueVirtualCode = sourceScript?.generated?.root;
|
|
25
|
-
if (!sourceScript || !virtualCode || !(vueVirtualCode instanceof language_core_1.
|
|
25
|
+
if (!sourceScript || !virtualCode || !(vueVirtualCode instanceof language_core_1.VueVirtualCode)) {
|
|
26
26
|
return;
|
|
27
27
|
}
|
|
28
28
|
let importUri;
|
|
@@ -18,7 +18,7 @@ function create(ts, getTsPluginClient) {
|
|
|
18
18
|
const decoded = context.decodeEmbeddedDocumentUri(document.uri);
|
|
19
19
|
const sourceScript = decoded && context.language.scripts.get(decoded[0]);
|
|
20
20
|
const virtualCode = decoded && sourceScript?.generated?.embeddedCodes.get(decoded[1]);
|
|
21
|
-
if (!(sourceScript?.generated?.root instanceof language_core_1.
|
|
21
|
+
if (!(sourceScript?.generated?.root instanceof language_core_1.VueVirtualCode) || virtualCode?.id !== 'template') {
|
|
22
22
|
return;
|
|
23
23
|
}
|
|
24
24
|
const { sfc } = sourceScript.generated.root;
|
|
@@ -48,7 +48,7 @@ function create(ts, getTsPluginClient) {
|
|
|
48
48
|
const decoded = context.decodeEmbeddedDocumentUri(uri);
|
|
49
49
|
const sourceScript = decoded && context.language.scripts.get(decoded[0]);
|
|
50
50
|
const virtualCode = decoded && sourceScript?.generated?.embeddedCodes.get(decoded[1]);
|
|
51
|
-
if (!(sourceScript?.generated?.root instanceof language_core_1.
|
|
51
|
+
if (!(sourceScript?.generated?.root instanceof language_core_1.VueVirtualCode) || virtualCode?.id !== 'template') {
|
|
52
52
|
return codeAction;
|
|
53
53
|
}
|
|
54
54
|
const document = context.documents.get(uri, virtualCode.languageId, virtualCode.snapshot);
|
package/lib/plugins/vue-sfc.d.ts
CHANGED
|
@@ -2,6 +2,6 @@ import type { LanguageServicePlugin } from '@volar/language-service';
|
|
|
2
2
|
import * as vue from '@vue/language-core';
|
|
3
3
|
import type { TextDocument } from 'vscode-languageserver-textdocument';
|
|
4
4
|
export interface Provide {
|
|
5
|
-
'vue/vueFile': (document: TextDocument) => vue.
|
|
5
|
+
'vue/vueFile': (document: TextDocument) => vue.VueVirtualCode | undefined;
|
|
6
6
|
}
|
|
7
7
|
export declare function create(): LanguageServicePlugin;
|
package/lib/plugins/vue-sfc.js
CHANGED
|
@@ -47,7 +47,7 @@ function create() {
|
|
|
47
47
|
},
|
|
48
48
|
},
|
|
49
49
|
async resolveEmbeddedCodeFormattingOptions(sourceScript, virtualCode, options) {
|
|
50
|
-
if (sourceScript.generated?.root instanceof vue.
|
|
50
|
+
if (sourceScript.generated?.root instanceof vue.VueVirtualCode) {
|
|
51
51
|
if (virtualCode.id === 'scriptFormat' || virtualCode.id === 'scriptSetupFormat') {
|
|
52
52
|
if (await context.env.getConfiguration?.('vue.format.script.initialIndent') ?? false) {
|
|
53
53
|
options.initialIndentLevel++;
|
|
@@ -156,7 +156,7 @@ function create() {
|
|
|
156
156
|
const decoded = context.decodeEmbeddedDocumentUri(document.uri);
|
|
157
157
|
const sourceScript = decoded && context.language.scripts.get(decoded[0]);
|
|
158
158
|
const virtualCode = decoded && sourceScript?.generated?.embeddedCodes.get(decoded[1]);
|
|
159
|
-
if (virtualCode instanceof vue.
|
|
159
|
+
if (virtualCode instanceof vue.VueVirtualCode) {
|
|
160
160
|
return callback(virtualCode);
|
|
161
161
|
}
|
|
162
162
|
}
|
|
@@ -16,6 +16,7 @@ let modelData;
|
|
|
16
16
|
function create(mode, ts, getVueOptions, getTsPluginClient) {
|
|
17
17
|
let customData = [];
|
|
18
18
|
let extraCustomData = [];
|
|
19
|
+
let lastCompletionComponentNames = new Set();
|
|
19
20
|
const onDidChangeCustomDataListeners = new Set();
|
|
20
21
|
const onDidChangeCustomData = (listener) => {
|
|
21
22
|
onDidChangeCustomDataListeners.add(listener);
|
|
@@ -91,7 +92,9 @@ function create(mode, ts, getVueOptions, getTsPluginClient) {
|
|
|
91
92
|
let currentVersion;
|
|
92
93
|
const decoded = context.decodeEmbeddedDocumentUri(document.uri);
|
|
93
94
|
const sourceScript = decoded && context.language.scripts.get(decoded[0]);
|
|
94
|
-
if (sourceScript?.generated?.root instanceof language_core_1.
|
|
95
|
+
if (sourceScript?.generated?.root instanceof language_core_1.VueVirtualCode) {
|
|
96
|
+
// #4298: Precompute HTMLDocument before provideHtmlData to avoid parseHTMLDocument requesting component names from tsserver
|
|
97
|
+
baseServiceInstance.provideCompletionItems?.(document, position, completionContext, token);
|
|
95
98
|
sync = (await provideHtmlData(sourceScript.id, sourceScript.generated.root)).sync;
|
|
96
99
|
currentVersion = await sync();
|
|
97
100
|
}
|
|
@@ -102,8 +105,8 @@ function create(mode, ts, getVueOptions, getTsPluginClient) {
|
|
|
102
105
|
if (!htmlComplete) {
|
|
103
106
|
return;
|
|
104
107
|
}
|
|
105
|
-
if (sourceScript?.generated?.root instanceof language_core_1.
|
|
106
|
-
await afterHtmlCompletion(htmlComplete, context.documents.get(sourceScript.id, sourceScript.languageId, sourceScript.snapshot)
|
|
108
|
+
if (sourceScript?.generated?.root instanceof language_core_1.VueVirtualCode) {
|
|
109
|
+
await afterHtmlCompletion(htmlComplete, context.documents.get(sourceScript.id, sourceScript.languageId, sourceScript.snapshot));
|
|
107
110
|
}
|
|
108
111
|
return htmlComplete;
|
|
109
112
|
},
|
|
@@ -125,9 +128,9 @@ function create(mode, ts, getVueOptions, getTsPluginClient) {
|
|
|
125
128
|
for (const map of context.documents.getMaps(virtualCode)) {
|
|
126
129
|
const code = context.language.scripts.get(map.sourceDocument.uri)?.generated?.root;
|
|
127
130
|
const scanner = getScanner(baseServiceInstance, document);
|
|
128
|
-
if (code instanceof language_core_1.
|
|
131
|
+
if (code instanceof language_core_1.VueVirtualCode && scanner) {
|
|
129
132
|
// visualize missing required props
|
|
130
|
-
const casing = await (0, nameCasing_1.getNameCasing)(context, map.sourceDocument.uri
|
|
133
|
+
const casing = await (0, nameCasing_1.getNameCasing)(context, map.sourceDocument.uri);
|
|
131
134
|
const components = await tsPluginClient?.getComponentNames(code.fileName) ?? [];
|
|
132
135
|
const componentProps = {};
|
|
133
136
|
let token;
|
|
@@ -135,10 +138,9 @@ function create(mode, ts, getVueOptions, getTsPluginClient) {
|
|
|
135
138
|
while ((token = scanner.scan()) !== html.TokenType.EOS) {
|
|
136
139
|
if (token === html.TokenType.StartTag) {
|
|
137
140
|
const tagName = scanner.getTokenText();
|
|
138
|
-
const
|
|
139
|
-
?
|
|
141
|
+
const checkTag = tagName.indexOf('.') >= 0
|
|
142
|
+
? tagName
|
|
140
143
|
: components.find(component => component === tagName || (0, language_core_1.hyphenateTag)(component) === tagName);
|
|
141
|
-
const checkTag = tagName.indexOf('.') >= 0 ? tagName : component;
|
|
142
144
|
if (checkTag) {
|
|
143
145
|
componentProps[checkTag] ??= await tsPluginClient?.getComponentProps(code.fileName, checkTag, true) ?? [];
|
|
144
146
|
current = {
|
|
@@ -234,7 +236,7 @@ function create(mode, ts, getVueOptions, getTsPluginClient) {
|
|
|
234
236
|
}
|
|
235
237
|
for (const map of context.documents.getMaps(virtualCode)) {
|
|
236
238
|
const code = context.language.scripts.get(map.sourceDocument.uri)?.generated?.root;
|
|
237
|
-
if (!(code instanceof language_core_1.
|
|
239
|
+
if (!(code instanceof language_core_1.VueVirtualCode)) {
|
|
238
240
|
continue;
|
|
239
241
|
}
|
|
240
242
|
const templateErrors = [];
|
|
@@ -281,7 +283,7 @@ function create(mode, ts, getVueOptions, getTsPluginClient) {
|
|
|
281
283
|
const decoded = context.decodeEmbeddedDocumentUri(document.uri);
|
|
282
284
|
const sourceScript = decoded && context.language.scripts.get(decoded[0]);
|
|
283
285
|
if (!sourceScript
|
|
284
|
-
|| !(sourceScript.generated?.root instanceof language_core_1.
|
|
286
|
+
|| !(sourceScript.generated?.root instanceof language_core_1.VueVirtualCode)
|
|
285
287
|
|| !sourceScript.generated.root.sfc.template) {
|
|
286
288
|
return [];
|
|
287
289
|
}
|
|
@@ -310,7 +312,7 @@ function create(mode, ts, getVueOptions, getTsPluginClient) {
|
|
|
310
312
|
};
|
|
311
313
|
async function provideHtmlData(sourceDocumentUri, vueCode) {
|
|
312
314
|
await (initializing ??= initialize());
|
|
313
|
-
const casing = await (0, nameCasing_1.getNameCasing)(context, sourceDocumentUri
|
|
315
|
+
const casing = await (0, nameCasing_1.getNameCasing)(context, sourceDocumentUri);
|
|
314
316
|
if (builtInData.tags) {
|
|
315
317
|
for (const tag of builtInData.tags) {
|
|
316
318
|
if (tag.name === 'slot') {
|
|
@@ -349,6 +351,7 @@ function create(mode, ts, getVueOptions, getTsPluginClient) {
|
|
|
349
351
|
&& name !== 'KeepAlive'
|
|
350
352
|
&& name !== 'Suspense'
|
|
351
353
|
&& name !== 'Teleport');
|
|
354
|
+
lastCompletionComponentNames = new Set(components);
|
|
352
355
|
version++;
|
|
353
356
|
})());
|
|
354
357
|
return [];
|
|
@@ -503,10 +506,8 @@ function create(mode, ts, getVueOptions, getTsPluginClient) {
|
|
|
503
506
|
}
|
|
504
507
|
};
|
|
505
508
|
}
|
|
506
|
-
async function afterHtmlCompletion(completionList, sourceDocument
|
|
509
|
+
async function afterHtmlCompletion(completionList, sourceDocument) {
|
|
507
510
|
const replacement = getReplacement(completionList, sourceDocument);
|
|
508
|
-
const componentNames = new Set((await tsPluginClient?.getComponentNames(code.fileName) ?? [])
|
|
509
|
-
.map(language_core_1.hyphenateTag));
|
|
510
511
|
if (replacement) {
|
|
511
512
|
const isEvent = replacement.text.startsWith('v-on:') || replacement.text.startsWith('@');
|
|
512
513
|
const isProp = replacement.text.startsWith('v-bind:') || replacement.text.startsWith(':');
|
|
@@ -570,7 +571,7 @@ function create(mode, ts, getVueOptions, getTsPluginClient) {
|
|
|
570
571
|
if (itemId) {
|
|
571
572
|
item.documentation = undefined;
|
|
572
573
|
}
|
|
573
|
-
if (item.kind === 10 &&
|
|
574
|
+
if (item.kind === 10 && lastCompletionComponentNames.has((0, language_core_1.hyphenateTag)(item.label))) {
|
|
574
575
|
item.kind = 6;
|
|
575
576
|
item.sortText = '\u0000' + (item.sortText ?? item.label);
|
|
576
577
|
}
|
|
@@ -13,7 +13,7 @@ function create(ts) {
|
|
|
13
13
|
const decoded = context.decodeEmbeddedDocumentUri(document.uri);
|
|
14
14
|
const sourceScript = decoded && context.language.scripts.get(decoded[0]);
|
|
15
15
|
const virtualCode = decoded && sourceScript?.generated?.embeddedCodes.get(decoded[1]);
|
|
16
|
-
if (!(virtualCode instanceof language_core_1.
|
|
16
|
+
if (!(virtualCode instanceof language_core_1.VueVirtualCode)) {
|
|
17
17
|
return;
|
|
18
18
|
}
|
|
19
19
|
const { template } = virtualCode.sfc;
|
|
@@ -13,7 +13,7 @@ function create(ts, getTsPluginClient) {
|
|
|
13
13
|
const decoded = context.decodeEmbeddedDocumentUri(document.uri);
|
|
14
14
|
const sourceScript = decoded && context.language.scripts.get(decoded[0]);
|
|
15
15
|
const virtualCode = decoded && sourceScript?.generated?.embeddedCodes.get(decoded[1]);
|
|
16
|
-
if (!(sourceScript?.generated?.root instanceof vue.
|
|
16
|
+
if (!(sourceScript?.generated?.root instanceof vue.VueVirtualCode) || virtualCode?.id !== 'template') {
|
|
17
17
|
return;
|
|
18
18
|
}
|
|
19
19
|
const hoverOffsets = [];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/language-service",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.15",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"files": [
|
|
6
6
|
"data",
|
|
@@ -16,32 +16,32 @@
|
|
|
16
16
|
"update-html-data": "node ./scripts/update-html-data.js"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@volar/language-core": "2.2.0-alpha.
|
|
20
|
-
"@volar/language-service": "2.2.0-alpha.
|
|
21
|
-
"@volar/typescript": "2.2.0-alpha.
|
|
19
|
+
"@volar/language-core": "2.2.0-alpha.12",
|
|
20
|
+
"@volar/language-service": "2.2.0-alpha.12",
|
|
21
|
+
"@volar/typescript": "2.2.0-alpha.12",
|
|
22
22
|
"@vue/compiler-dom": "^3.4.0",
|
|
23
|
-
"@vue/language-core": "2.0.
|
|
23
|
+
"@vue/language-core": "2.0.15",
|
|
24
24
|
"@vue/shared": "^3.4.0",
|
|
25
|
-
"@vue/typescript-plugin": "2.0.
|
|
25
|
+
"@vue/typescript-plugin": "2.0.15",
|
|
26
26
|
"computeds": "^0.0.1",
|
|
27
27
|
"path-browserify": "^1.0.1",
|
|
28
|
-
"volar-service-css": "0.0.
|
|
29
|
-
"volar-service-emmet": "0.0.
|
|
30
|
-
"volar-service-html": "0.0.
|
|
31
|
-
"volar-service-json": "0.0.
|
|
32
|
-
"volar-service-pug": "0.0.
|
|
33
|
-
"volar-service-pug-beautify": "0.0.
|
|
34
|
-
"volar-service-typescript": "0.0.
|
|
35
|
-
"volar-service-typescript-twoslash-queries": "0.0.
|
|
36
|
-
"vscode-html-languageservice": "
|
|
28
|
+
"volar-service-css": "0.0.40",
|
|
29
|
+
"volar-service-emmet": "0.0.40",
|
|
30
|
+
"volar-service-html": "0.0.40",
|
|
31
|
+
"volar-service-json": "0.0.40",
|
|
32
|
+
"volar-service-pug": "0.0.40",
|
|
33
|
+
"volar-service-pug-beautify": "0.0.40",
|
|
34
|
+
"volar-service-typescript": "0.0.40",
|
|
35
|
+
"volar-service-typescript-twoslash-queries": "0.0.40",
|
|
36
|
+
"vscode-html-languageservice": "npm:@johnsoncodehk/vscode-html-languageservice@5.2.0-34a5462",
|
|
37
37
|
"vscode-languageserver-textdocument": "^1.0.11",
|
|
38
38
|
"vscode-uri": "^3.0.8"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@types/node": "latest",
|
|
42
42
|
"@types/path-browserify": "latest",
|
|
43
|
-
"@volar/kit": "2.2.0-alpha.
|
|
43
|
+
"@volar/kit": "2.2.0-alpha.12",
|
|
44
44
|
"vscode-languageserver-protocol": "^3.17.5"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "095f44449d71cd5a4730306c9c8c40df4d44dce3"
|
|
47
47
|
}
|
|
@@ -56,6 +56,24 @@ const langs = [
|
|
|
56
56
|
repoUrl: 'https://raw.githubusercontent.com/vuejs-translations/docs-it/',
|
|
57
57
|
supported: true,
|
|
58
58
|
},
|
|
59
|
+
{
|
|
60
|
+
name: 'cs',
|
|
61
|
+
url: 'https://cs.vuejs.org/',
|
|
62
|
+
repoUrl: 'https://raw.githubusercontent.com/vuejs-translations/docs-cs/',
|
|
63
|
+
supported: true,
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
name: 'ru',
|
|
67
|
+
url: 'https://ru.vuejs.org/',
|
|
68
|
+
repoUrl: 'https://raw.githubusercontent.com/vuejs-translations/docs-ru/',
|
|
69
|
+
supported: true,
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
name: 'fa',
|
|
73
|
+
url: 'https://fa.vuejs.org/',
|
|
74
|
+
repoUrl: 'https://raw.githubusercontent.com/vuejs-translations/docs-fa/',
|
|
75
|
+
supported: false,
|
|
76
|
+
},
|
|
59
77
|
];
|
|
60
78
|
|
|
61
79
|
for (const lang of langs) {
|