@vue/language-service 2.0.18 → 2.0.20
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 +69 -1
- package/data/language-blocks/en.json +69 -1
- package/data/language-blocks/fr.json +69 -1
- package/data/language-blocks/it.json +68 -0
- package/data/language-blocks/ja.json +69 -1
- package/data/language-blocks/ko.json +70 -2
- package/data/language-blocks/pt.json +68 -0
- package/data/language-blocks/ru.json +69 -1
- package/data/language-blocks/zh-cn.json +69 -1
- package/data/language-blocks/zh-hk.json +1102 -0
- package/data/model-modifiers/cs.json +12 -0
- package/data/model-modifiers/en.json +12 -0
- package/data/model-modifiers/fr.json +12 -0
- package/data/model-modifiers/it.json +12 -0
- package/data/model-modifiers/ja.json +12 -0
- package/data/model-modifiers/ko.json +12 -0
- package/data/model-modifiers/pt.json +12 -0
- package/data/model-modifiers/ru.json +12 -0
- package/data/model-modifiers/zh-cn.json +12 -0
- package/data/model-modifiers/zh-hk.json +188 -0
- package/data/template/cs.json +104 -0
- package/data/template/en.json +104 -0
- package/data/template/fr.json +104 -0
- package/data/template/it.json +104 -0
- package/data/template/ja.json +104 -0
- package/data/template/ko.json +105 -1
- package/data/template/pt.json +104 -0
- package/data/template/ru.json +104 -0
- package/data/template/zh-cn.json +104 -0
- package/data/template/zh-hk.json +1602 -0
- package/index.d.ts +3 -3
- package/index.js +8 -9
- package/lib/ideFeatures/nameCasing.d.ts +6 -5
- package/lib/ideFeatures/nameCasing.js +2 -2
- package/lib/plugins/css.js +2 -2
- package/lib/plugins/data.js +9 -0
- package/lib/plugins/vue-autoinsert-dotvalue.d.ts +2 -2
- package/lib/plugins/vue-autoinsert-dotvalue.js +17 -7
- package/lib/plugins/vue-autoinsert-space.js +7 -1
- package/lib/plugins/vue-codelens-references.d.ts +2 -0
- package/lib/plugins/vue-codelens-references.js +42 -0
- package/lib/plugins/vue-directive-comments.js +5 -1
- package/lib/plugins/vue-document-drop.d.ts +2 -2
- package/lib/plugins/vue-document-drop.js +12 -6
- package/lib/plugins/vue-document-links.js +6 -3
- package/lib/plugins/vue-extract-file.d.ts +2 -2
- package/lib/plugins/vue-extract-file.js +11 -4
- package/lib/plugins/vue-sfc.js +4 -3
- package/lib/plugins/vue-template.d.ts +2 -2
- package/lib/plugins/vue-template.js +155 -132
- package/lib/plugins/vue-toggle-v-bind-codeaction.js +7 -1
- package/lib/plugins/vue-twoslash-queries.d.ts +2 -2
- package/lib/plugins/vue-twoslash-queries.js +6 -2
- package/lib/plugins/vue-visualize-hidden-callback-param.js +5 -1
- package/package.json +16 -16
- package/scripts/update-html-data.js +6 -0
|
@@ -48,13 +48,27 @@ function create(mode, ts, getVueOptions, getTsPluginClient) {
|
|
|
48
48
|
});
|
|
49
49
|
return {
|
|
50
50
|
name: `vue-template (${mode})`,
|
|
51
|
-
|
|
52
|
-
...baseService.
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
51
|
+
capabilities: {
|
|
52
|
+
...baseService.capabilities,
|
|
53
|
+
completionProvider: {
|
|
54
|
+
triggerCharacters: [
|
|
55
|
+
...baseService.capabilities.completionProvider?.triggerCharacters ?? [],
|
|
56
|
+
'@', // vue event shorthand
|
|
57
|
+
],
|
|
58
|
+
},
|
|
59
|
+
inlayHintProvider: {},
|
|
60
|
+
hoverProvider: true,
|
|
61
|
+
diagnosticProvider: true,
|
|
62
|
+
semanticTokensProvider: {
|
|
63
|
+
legend: {
|
|
64
|
+
tokenTypes: ['class'],
|
|
65
|
+
tokenModifiers: [],
|
|
66
|
+
},
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
create(context, api) {
|
|
56
70
|
const tsPluginClient = getTsPluginClient?.(context);
|
|
57
|
-
const baseServiceInstance = baseService.create(context);
|
|
71
|
+
const baseServiceInstance = baseService.create(context, api);
|
|
58
72
|
const vueCompilerOptions = getVueOptions(context.env);
|
|
59
73
|
builtInData ??= (0, data_1.loadTemplateData)(context.env.locale ?? 'en');
|
|
60
74
|
modelData ??= (0, data_1.loadModelModifiersData)(context.env.locale ?? 'en');
|
|
@@ -100,7 +114,7 @@ function create(mode, ts, getVueOptions, getTsPluginClient) {
|
|
|
100
114
|
}
|
|
101
115
|
let sync;
|
|
102
116
|
let currentVersion;
|
|
103
|
-
const decoded = context.decodeEmbeddedDocumentUri(document.uri);
|
|
117
|
+
const decoded = context.decodeEmbeddedDocumentUri(vscode_uri_1.URI.parse(document.uri));
|
|
104
118
|
const sourceScript = decoded && context.language.scripts.get(decoded[0]);
|
|
105
119
|
if (sourceScript?.generated?.root instanceof language_core_1.VueVirtualCode) {
|
|
106
120
|
// #4298: Precompute HTMLDocument before provideHtmlData to avoid parseHTMLDocument requesting component names from tsserver
|
|
@@ -129,95 +143,94 @@ function create(mode, ts, getVueOptions, getTsPluginClient) {
|
|
|
129
143
|
return;
|
|
130
144
|
}
|
|
131
145
|
const result = [];
|
|
132
|
-
const
|
|
146
|
+
const uri = vscode_uri_1.URI.parse(document.uri);
|
|
147
|
+
const decoded = context.decodeEmbeddedDocumentUri(uri);
|
|
133
148
|
const sourceScript = decoded && context.language.scripts.get(decoded[0]);
|
|
134
149
|
const virtualCode = decoded && sourceScript?.generated?.embeddedCodes.get(decoded[1]);
|
|
135
150
|
if (!virtualCode) {
|
|
136
151
|
return;
|
|
137
152
|
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
};
|
|
161
|
-
}
|
|
153
|
+
const code = context.language.scripts.get(decoded[0])?.generated?.root;
|
|
154
|
+
const scanner = getScanner(baseServiceInstance, document);
|
|
155
|
+
if (code instanceof language_core_1.VueVirtualCode && scanner) {
|
|
156
|
+
// visualize missing required props
|
|
157
|
+
const casing = await (0, nameCasing_1.getNameCasing)(context, decoded[0]);
|
|
158
|
+
const components = await tsPluginClient?.getComponentNames(code.fileName) ?? [];
|
|
159
|
+
const componentProps = {};
|
|
160
|
+
let token;
|
|
161
|
+
let current;
|
|
162
|
+
while ((token = scanner.scan()) !== html.TokenType.EOS) {
|
|
163
|
+
if (token === html.TokenType.StartTag) {
|
|
164
|
+
const tagName = scanner.getTokenText();
|
|
165
|
+
const checkTag = tagName.indexOf('.') >= 0
|
|
166
|
+
? tagName
|
|
167
|
+
: components.find(component => component === tagName || (0, language_core_1.hyphenateTag)(component) === tagName);
|
|
168
|
+
if (checkTag) {
|
|
169
|
+
componentProps[checkTag] ??= await tsPluginClient?.getComponentProps(code.fileName, checkTag, true) ?? [];
|
|
170
|
+
current = {
|
|
171
|
+
unburnedRequiredProps: [...componentProps[checkTag]],
|
|
172
|
+
labelOffset: scanner.getTokenOffset() + scanner.getTokenLength(),
|
|
173
|
+
insertOffset: scanner.getTokenOffset() + scanner.getTokenLength(),
|
|
174
|
+
};
|
|
162
175
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
176
|
+
}
|
|
177
|
+
else if (token === html.TokenType.AttributeName) {
|
|
178
|
+
if (current) {
|
|
179
|
+
let attrText = scanner.getTokenText();
|
|
180
|
+
if (attrText === 'v-bind') {
|
|
181
|
+
current.unburnedRequiredProps = [];
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
// remove modifiers
|
|
185
|
+
if (attrText.indexOf('.') >= 0) {
|
|
186
|
+
attrText = attrText.split('.')[0];
|
|
168
187
|
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
attrText = attrText.split('.')[0];
|
|
173
|
-
}
|
|
174
|
-
// normalize
|
|
175
|
-
if (attrText.startsWith('v-bind:')) {
|
|
176
|
-
attrText = attrText.substring('v-bind:'.length);
|
|
177
|
-
}
|
|
178
|
-
else if (attrText.startsWith(':')) {
|
|
179
|
-
attrText = attrText.substring(':'.length);
|
|
180
|
-
}
|
|
181
|
-
else if (attrText.startsWith('v-model:')) {
|
|
182
|
-
attrText = attrText.substring('v-model:'.length);
|
|
183
|
-
}
|
|
184
|
-
else if (attrText === 'v-model') {
|
|
185
|
-
attrText = vueCompilerOptions.target >= 3 ? 'modelValue' : 'value'; // TODO: support for experimentalModelPropName?
|
|
186
|
-
}
|
|
187
|
-
else if (attrText.startsWith('@')) {
|
|
188
|
-
attrText = 'on-' + (0, language_core_1.hyphenateAttr)(attrText.substring('@'.length));
|
|
189
|
-
}
|
|
190
|
-
current.unburnedRequiredProps = current.unburnedRequiredProps.filter(propName => {
|
|
191
|
-
return attrText !== propName
|
|
192
|
-
&& attrText !== (0, language_core_1.hyphenateAttr)(propName);
|
|
193
|
-
});
|
|
188
|
+
// normalize
|
|
189
|
+
if (attrText.startsWith('v-bind:')) {
|
|
190
|
+
attrText = attrText.substring('v-bind:'.length);
|
|
194
191
|
}
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
range: {
|
|
207
|
-
start: document.positionAt(current.insertOffset),
|
|
208
|
-
end: document.positionAt(current.insertOffset),
|
|
209
|
-
},
|
|
210
|
-
newText: ` :${casing.attr === types_1.AttrNameCasing.Kebab ? (0, language_core_1.hyphenateAttr)(requiredProp) : requiredProp}=`,
|
|
211
|
-
}],
|
|
212
|
-
});
|
|
192
|
+
else if (attrText.startsWith(':')) {
|
|
193
|
+
attrText = attrText.substring(':'.length);
|
|
194
|
+
}
|
|
195
|
+
else if (attrText.startsWith('v-model:')) {
|
|
196
|
+
attrText = attrText.substring('v-model:'.length);
|
|
197
|
+
}
|
|
198
|
+
else if (attrText === 'v-model') {
|
|
199
|
+
attrText = vueCompilerOptions.target >= 3 ? 'modelValue' : 'value'; // TODO: support for experimentalModelPropName?
|
|
200
|
+
}
|
|
201
|
+
else if (attrText.startsWith('@')) {
|
|
202
|
+
attrText = 'on-' + (0, language_core_1.hyphenateAttr)(attrText.substring('@'.length));
|
|
213
203
|
}
|
|
214
|
-
current =
|
|
204
|
+
current.unburnedRequiredProps = current.unburnedRequiredProps.filter(propName => {
|
|
205
|
+
return attrText !== propName
|
|
206
|
+
&& attrText !== (0, language_core_1.hyphenateAttr)(propName);
|
|
207
|
+
});
|
|
215
208
|
}
|
|
216
209
|
}
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
210
|
+
}
|
|
211
|
+
else if (token === html.TokenType.StartTagSelfClose || token === html.TokenType.StartTagClose) {
|
|
212
|
+
if (current) {
|
|
213
|
+
for (const requiredProp of current.unburnedRequiredProps) {
|
|
214
|
+
result.push({
|
|
215
|
+
label: `${requiredProp}!`,
|
|
216
|
+
paddingLeft: true,
|
|
217
|
+
position: document.positionAt(current.labelOffset),
|
|
218
|
+
kind: 2,
|
|
219
|
+
textEdits: [{
|
|
220
|
+
range: {
|
|
221
|
+
start: document.positionAt(current.insertOffset),
|
|
222
|
+
end: document.positionAt(current.insertOffset),
|
|
223
|
+
},
|
|
224
|
+
newText: ` :${casing.attr === types_1.AttrNameCasing.Kebab ? (0, language_core_1.hyphenateAttr)(requiredProp) : requiredProp}=`,
|
|
225
|
+
}],
|
|
226
|
+
});
|
|
220
227
|
}
|
|
228
|
+
current = undefined;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
if (token === html.TokenType.AttributeName || token === html.TokenType.AttributeValue) {
|
|
232
|
+
if (current) {
|
|
233
|
+
current.insertOffset = scanner.getTokenOffset() + scanner.getTokenLength();
|
|
221
234
|
}
|
|
222
235
|
}
|
|
223
236
|
}
|
|
@@ -228,7 +241,7 @@ function create(mode, ts, getVueOptions, getTsPluginClient) {
|
|
|
228
241
|
if (!isSupportedDocument(document)) {
|
|
229
242
|
return;
|
|
230
243
|
}
|
|
231
|
-
if (context.decodeEmbeddedDocumentUri(document.uri)) {
|
|
244
|
+
if (context.decodeEmbeddedDocumentUri(vscode_uri_1.URI.parse(document.uri))) {
|
|
232
245
|
updateExtraCustomData([]);
|
|
233
246
|
}
|
|
234
247
|
return baseServiceInstance.provideHover?.(document, position, token);
|
|
@@ -238,49 +251,48 @@ function create(mode, ts, getVueOptions, getTsPluginClient) {
|
|
|
238
251
|
return;
|
|
239
252
|
}
|
|
240
253
|
const originalResult = await baseServiceInstance.provideDiagnostics?.(document, token);
|
|
241
|
-
const
|
|
254
|
+
const uri = vscode_uri_1.URI.parse(document.uri);
|
|
255
|
+
const decoded = context.decodeEmbeddedDocumentUri(uri);
|
|
242
256
|
const sourceScript = decoded && context.language.scripts.get(decoded[0]);
|
|
243
257
|
const virtualCode = decoded && sourceScript?.generated?.embeddedCodes.get(decoded[1]);
|
|
244
258
|
if (!virtualCode) {
|
|
245
259
|
return;
|
|
246
260
|
}
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
261
|
+
const code = context.language.scripts.get(decoded[0])?.generated?.root;
|
|
262
|
+
if (!(code instanceof language_core_1.VueVirtualCode)) {
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
const templateErrors = [];
|
|
266
|
+
const { template } = code.sfc;
|
|
267
|
+
if (template) {
|
|
268
|
+
for (const error of template.errors) {
|
|
269
|
+
onCompilerError(error, 1);
|
|
251
270
|
}
|
|
252
|
-
const
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
start:
|
|
264
|
-
end:
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
},
|
|
272
|
-
severity,
|
|
273
|
-
code: error.code,
|
|
274
|
-
source: 'vue',
|
|
275
|
-
message: errorMessage,
|
|
276
|
-
});
|
|
277
|
-
}
|
|
271
|
+
for (const warning of template.warnings) {
|
|
272
|
+
onCompilerError(warning, 2);
|
|
273
|
+
}
|
|
274
|
+
function onCompilerError(error, severity) {
|
|
275
|
+
const templateHtmlRange = {
|
|
276
|
+
start: error.loc?.start.offset ?? 0,
|
|
277
|
+
end: error.loc?.end.offset ?? 0,
|
|
278
|
+
};
|
|
279
|
+
let errorMessage = error.message;
|
|
280
|
+
templateErrors.push({
|
|
281
|
+
range: {
|
|
282
|
+
start: document.positionAt(templateHtmlRange.start),
|
|
283
|
+
end: document.positionAt(templateHtmlRange.end),
|
|
284
|
+
},
|
|
285
|
+
severity,
|
|
286
|
+
code: error.code,
|
|
287
|
+
source: 'vue',
|
|
288
|
+
message: errorMessage,
|
|
289
|
+
});
|
|
278
290
|
}
|
|
279
|
-
return [
|
|
280
|
-
...originalResult ?? [],
|
|
281
|
-
...templateErrors,
|
|
282
|
-
];
|
|
283
291
|
}
|
|
292
|
+
return [
|
|
293
|
+
...originalResult ?? [],
|
|
294
|
+
...templateErrors,
|
|
295
|
+
];
|
|
284
296
|
},
|
|
285
297
|
provideDocumentSemanticTokens(document, range, legend) {
|
|
286
298
|
if (!isSupportedDocument(document)) {
|
|
@@ -290,7 +302,7 @@ function create(mode, ts, getVueOptions, getTsPluginClient) {
|
|
|
290
302
|
if (!languageService) {
|
|
291
303
|
return;
|
|
292
304
|
}
|
|
293
|
-
const decoded = context.decodeEmbeddedDocumentUri(document.uri);
|
|
305
|
+
const decoded = context.decodeEmbeddedDocumentUri(vscode_uri_1.URI.parse(document.uri));
|
|
294
306
|
const sourceScript = decoded && context.language.scripts.get(decoded[0]);
|
|
295
307
|
if (!sourceScript
|
|
296
308
|
|| !(sourceScript.generated?.root instanceof language_core_1.VueVirtualCode)
|
|
@@ -403,7 +415,8 @@ function create(mode, ts, getVueOptions, getTsPluginClient) {
|
|
|
403
415
|
const events = await tsPluginClient?.getComponentEvents(vueCode.fileName, tag) ?? [];
|
|
404
416
|
tagInfos.set(tag, {
|
|
405
417
|
attrs,
|
|
406
|
-
props
|
|
418
|
+
props: props.filter(prop => !prop.startsWith('ref_')
|
|
419
|
+
&& !(0, shared_1.hyphenate)(prop).startsWith('on-vnode-')),
|
|
407
420
|
events,
|
|
408
421
|
});
|
|
409
422
|
version++;
|
|
@@ -588,7 +601,15 @@ function create(mode, ts, getVueOptions, getTsPluginClient) {
|
|
|
588
601
|
else if (itemId && (itemId.type === 'componentProp' || itemId.type === 'componentEvent')) {
|
|
589
602
|
const [componentName] = itemId.args;
|
|
590
603
|
if (componentName !== '*') {
|
|
591
|
-
item.
|
|
604
|
+
if (item.label === 'class'
|
|
605
|
+
|| item.label === 'ref'
|
|
606
|
+
|| item.label.endsWith(':class')
|
|
607
|
+
|| item.label.endsWith(':ref')) {
|
|
608
|
+
item.sortText = '\u0000' + (item.sortText ?? item.label);
|
|
609
|
+
}
|
|
610
|
+
else {
|
|
611
|
+
item.sortText = '\u0000\u0000' + (item.sortText ?? item.label);
|
|
612
|
+
}
|
|
592
613
|
}
|
|
593
614
|
if (itemId.type === 'componentProp') {
|
|
594
615
|
if (componentName !== '*') {
|
|
@@ -623,15 +644,17 @@ function create(mode, ts, getVueOptions, getTsPluginClient) {
|
|
|
623
644
|
const customData = await context.env.getConfiguration?.('html.customData') ?? [];
|
|
624
645
|
const newData = [];
|
|
625
646
|
for (const customDataPath of customData) {
|
|
626
|
-
const
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
647
|
+
for (const workspaceFolder of context.env.workspaceFolders) {
|
|
648
|
+
const uri = vscode_uri_1.Utils.resolvePath(workspaceFolder, customDataPath);
|
|
649
|
+
const json = await context.env.fs?.readFile?.(uri);
|
|
650
|
+
if (json) {
|
|
651
|
+
try {
|
|
652
|
+
const data = JSON.parse(json);
|
|
653
|
+
newData.push(html.newHTMLDataProvider(customDataPath, data));
|
|
654
|
+
}
|
|
655
|
+
catch (error) {
|
|
656
|
+
console.error(error);
|
|
657
|
+
}
|
|
635
658
|
}
|
|
636
659
|
}
|
|
637
660
|
}
|
|
@@ -2,15 +2,21 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.create = void 0;
|
|
4
4
|
const language_core_1 = require("@vue/language-core");
|
|
5
|
+
const vscode_uri_1 = require("vscode-uri");
|
|
5
6
|
function create(ts) {
|
|
6
7
|
return {
|
|
7
8
|
name: 'vue-toggle-v-bind-codeaction',
|
|
9
|
+
capabilities: {
|
|
10
|
+
codeActionProvider: {
|
|
11
|
+
codeActionKinds: ['refactor'],
|
|
12
|
+
},
|
|
13
|
+
},
|
|
8
14
|
create(context) {
|
|
9
15
|
return {
|
|
10
16
|
provideCodeActions(document, range, _context) {
|
|
11
17
|
const startOffset = document.offsetAt(range.start);
|
|
12
18
|
const endOffset = document.offsetAt(range.end);
|
|
13
|
-
const decoded = context.decodeEmbeddedDocumentUri(document.uri);
|
|
19
|
+
const decoded = context.decodeEmbeddedDocumentUri(vscode_uri_1.URI.parse(document.uri));
|
|
14
20
|
const sourceScript = decoded && context.language.scripts.get(decoded[0]);
|
|
15
21
|
const virtualCode = decoded && sourceScript?.generated?.embeddedCodes.get(decoded[1]);
|
|
16
22
|
if (!(virtualCode instanceof language_core_1.VueVirtualCode)) {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare function create(ts: typeof import('typescript'), getTsPluginClient?: (context:
|
|
1
|
+
import type { LanguageServiceContext, LanguageServicePlugin } from '@volar/language-service';
|
|
2
|
+
export declare function create(ts: typeof import('typescript'), getTsPluginClient?: (context: LanguageServiceContext) => typeof import('@vue/typescript-plugin/lib/client') | undefined): LanguageServicePlugin;
|
|
@@ -2,15 +2,19 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.create = void 0;
|
|
4
4
|
const vue = require("@vue/language-core");
|
|
5
|
+
const vscode_uri_1 = require("vscode-uri");
|
|
5
6
|
const twoslashReg = /<!--\s*\^\?\s*-->/g;
|
|
6
7
|
function create(ts, getTsPluginClient) {
|
|
7
8
|
return {
|
|
8
9
|
name: 'vue-twoslash-queries',
|
|
10
|
+
capabilities: {
|
|
11
|
+
inlayHintProvider: {},
|
|
12
|
+
},
|
|
9
13
|
create(context) {
|
|
10
14
|
const tsPluginClient = getTsPluginClient?.(context);
|
|
11
15
|
return {
|
|
12
16
|
async provideInlayHints(document, range) {
|
|
13
|
-
const decoded = context.decodeEmbeddedDocumentUri(document.uri);
|
|
17
|
+
const decoded = context.decodeEmbeddedDocumentUri(vscode_uri_1.URI.parse(document.uri));
|
|
14
18
|
const sourceScript = decoded && context.language.scripts.get(decoded[0]);
|
|
15
19
|
const virtualCode = decoded && sourceScript?.generated?.embeddedCodes.get(decoded[1]);
|
|
16
20
|
if (!(sourceScript?.generated?.root instanceof vue.VueVirtualCode) || virtualCode?.id !== 'template') {
|
|
@@ -27,7 +31,7 @@ function create(ts, getTsPluginClient) {
|
|
|
27
31
|
})]);
|
|
28
32
|
}
|
|
29
33
|
for (const [pointerPosition, hoverOffset] of hoverOffsets) {
|
|
30
|
-
for (const [_1,
|
|
34
|
+
for (const [_1, _2, map] of context.language.maps.forEach(virtualCode)) {
|
|
31
35
|
for (const [sourceOffset] of map.getSourceOffsets(hoverOffset)) {
|
|
32
36
|
const quickInfo = await tsPluginClient?.getQuickInfoAtPosition(sourceScript.generated.root.fileName, sourceOffset);
|
|
33
37
|
if (quickInfo) {
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.create = void 0;
|
|
4
|
+
const vscode_uri_1 = require("vscode-uri");
|
|
4
5
|
function create() {
|
|
5
6
|
return {
|
|
6
7
|
name: 'vue-inlay-hints-hidden-callback-param',
|
|
8
|
+
capabilities: {
|
|
9
|
+
inlayHintProvider: {},
|
|
10
|
+
},
|
|
7
11
|
create(context) {
|
|
8
12
|
return {
|
|
9
13
|
async provideInlayHints(document, range) {
|
|
10
14
|
const settings = {};
|
|
11
15
|
const result = [];
|
|
12
|
-
const decoded = context.decodeEmbeddedDocumentUri(document.uri);
|
|
16
|
+
const decoded = context.decodeEmbeddedDocumentUri(vscode_uri_1.URI.parse(document.uri));
|
|
13
17
|
const sourceScript = decoded && context.language.scripts.get(decoded[0]);
|
|
14
18
|
const vitualCode = decoded && sourceScript?.generated?.embeddedCodes.get(decoded[1]);
|
|
15
19
|
if (vitualCode) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/language-service",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.20",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"files": [
|
|
6
6
|
"data",
|
|
@@ -16,23 +16,23 @@
|
|
|
16
16
|
"update-html-data": "node ./scripts/update-html-data.js"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@volar/language-core": "~2.
|
|
20
|
-
"@volar/language-service": "~2.
|
|
21
|
-
"@volar/typescript": "~2.
|
|
19
|
+
"@volar/language-core": "~2.3.0-alpha.14",
|
|
20
|
+
"@volar/language-service": "~2.3.0-alpha.14",
|
|
21
|
+
"@volar/typescript": "~2.3.0-alpha.14",
|
|
22
22
|
"@vue/compiler-dom": "^3.4.0",
|
|
23
|
-
"@vue/language-core": "2.0.
|
|
23
|
+
"@vue/language-core": "2.0.20",
|
|
24
24
|
"@vue/shared": "^3.4.0",
|
|
25
|
-
"@vue/typescript-plugin": "2.0.
|
|
25
|
+
"@vue/typescript-plugin": "2.0.20",
|
|
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.
|
|
28
|
+
"volar-service-css": "0.0.50",
|
|
29
|
+
"volar-service-emmet": "0.0.50",
|
|
30
|
+
"volar-service-html": "0.0.50",
|
|
31
|
+
"volar-service-json": "0.0.50",
|
|
32
|
+
"volar-service-pug": "0.0.50",
|
|
33
|
+
"volar-service-pug-beautify": "0.0.50",
|
|
34
|
+
"volar-service-typescript": "0.0.50",
|
|
35
|
+
"volar-service-typescript-twoslash-queries": "0.0.50",
|
|
36
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"
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@types/node": "latest",
|
|
42
42
|
"@types/path-browserify": "latest",
|
|
43
|
-
"@volar/kit": "~2.
|
|
43
|
+
"@volar/kit": "~2.3.0-alpha.14",
|
|
44
44
|
"vscode-languageserver-protocol": "^3.17.5"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "e1a5d2f136bf60a772c9655f9f5474c7f71a2ff9"
|
|
47
47
|
}
|
|
@@ -14,6 +14,12 @@ const langs = [
|
|
|
14
14
|
repoUrl: 'https://raw.githubusercontent.com/vuejs-translations/docs-zh-cn/',
|
|
15
15
|
supported: true,
|
|
16
16
|
},
|
|
17
|
+
{
|
|
18
|
+
name: 'zh-hk',
|
|
19
|
+
url: 'https://zh-hk.vuejs.org/',
|
|
20
|
+
repoUrl: 'https://raw.githubusercontent.com/vuejs-translations/docs-zh-hk/',
|
|
21
|
+
supported: true,
|
|
22
|
+
},
|
|
17
23
|
{
|
|
18
24
|
name: 'ja',
|
|
19
25
|
url: 'https://ja.vuejs.org/',
|