@vue/language-service 3.0.0-beta.1 → 3.0.0-beta.3
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.js +1 -1
- package/lib/plugins/css.js +1 -1
- package/lib/plugins/data.js +2 -1
- package/lib/plugins/vue-complete-define-assignment.js +4 -4
- package/lib/plugins/vue-directive-comments.js +1 -1
- package/lib/plugins/vue-inlayhints.js +6 -2
- package/lib/plugins/vue-sfc.js +4 -4
- package/lib/plugins/vue-template.js +6 -6
- package/package.json +4 -4
- package/scripts/update-html-data.js +3 -3
package/index.js
CHANGED
|
@@ -44,7 +44,7 @@ function createVueLanguageServicePlugins(ts, tsPluginClient) {
|
|
|
44
44
|
const plugins = [
|
|
45
45
|
(0, syntactic_1.create)(ts),
|
|
46
46
|
(0, docCommentTemplate_1.create)(ts),
|
|
47
|
-
...getCommonLanguageServicePlugins(ts, () => tsPluginClient)
|
|
47
|
+
...getCommonLanguageServicePlugins(ts, () => tsPluginClient),
|
|
48
48
|
];
|
|
49
49
|
if (tsPluginClient) {
|
|
50
50
|
plugins.push((0, vue_document_highlights_1.create)(tsPluginClient.getDocumentHighlights));
|
package/lib/plugins/css.js
CHANGED
|
@@ -41,7 +41,7 @@ function create() {
|
|
|
41
41
|
return worker(document, (stylesheet, cssLs) => {
|
|
42
42
|
return cssLs.prepareRename(document, position, stylesheet);
|
|
43
43
|
});
|
|
44
|
-
}
|
|
44
|
+
},
|
|
45
45
|
};
|
|
46
46
|
function isWithinNavigationVirtualCode(document, position) {
|
|
47
47
|
const uri = vscode_uri_1.URI.parse(document.uri);
|
package/lib/plugins/data.js
CHANGED
|
@@ -38,6 +38,7 @@ function loadTemplateData(lang) {
|
|
|
38
38
|
data = require('../../data/template/en.json');
|
|
39
39
|
}
|
|
40
40
|
resolveReferences(data);
|
|
41
|
+
// oxlint-disable-next-line no-useless-spread
|
|
41
42
|
for (const attr of [...data.globalAttributes ?? []]) {
|
|
42
43
|
if (!attr.name.startsWith('v-')) {
|
|
43
44
|
data.globalAttributes?.push({ ...attr, name: `:${attr.name}` }, { ...attr, name: `v-bind:${attr.name}` });
|
|
@@ -139,7 +140,7 @@ function resolveReferences(data) {
|
|
|
139
140
|
const relativeUrl = item.references;
|
|
140
141
|
item.references = locale.map(({ name, url }) => ({
|
|
141
142
|
name,
|
|
142
|
-
url: url + relativeUrl
|
|
143
|
+
url: url + relativeUrl,
|
|
143
144
|
}));
|
|
144
145
|
}
|
|
145
146
|
}
|
|
@@ -46,7 +46,7 @@ function create() {
|
|
|
46
46
|
addDefineCompletionItem(scriptSetupRanges.defineSlots?.statement, scriptSetupRanges.defineSlots?.exp, 'slots');
|
|
47
47
|
return {
|
|
48
48
|
isIncomplete: false,
|
|
49
|
-
items: result
|
|
49
|
+
items: result,
|
|
50
50
|
};
|
|
51
51
|
function addDefineCompletionItem(statement, exp, name) {
|
|
52
52
|
if (!exp || exp.start !== statement?.start) {
|
|
@@ -71,9 +71,9 @@ function create() {
|
|
|
71
71
|
newText: `const ${name} = `,
|
|
72
72
|
range: {
|
|
73
73
|
start: pos,
|
|
74
|
-
end: pos
|
|
75
|
-
}
|
|
76
|
-
}]
|
|
74
|
+
end: pos,
|
|
75
|
+
},
|
|
76
|
+
}],
|
|
77
77
|
});
|
|
78
78
|
}
|
|
79
79
|
},
|
|
@@ -175,7 +175,9 @@ function findDestructuredProps(ts, ast, props) {
|
|
|
175
175
|
}
|
|
176
176
|
});
|
|
177
177
|
function enter(node) {
|
|
178
|
-
|
|
178
|
+
if (parent) {
|
|
179
|
+
parentStack.push(parent);
|
|
180
|
+
}
|
|
179
181
|
if (ts.isTypeLiteralNode(node) ||
|
|
180
182
|
ts.isTypeReferenceNode(node)) {
|
|
181
183
|
return false;
|
|
@@ -215,7 +217,9 @@ function findDestructuredProps(ts, ast, props) {
|
|
|
215
217
|
}
|
|
216
218
|
}
|
|
217
219
|
function leave(node) {
|
|
218
|
-
|
|
220
|
+
if (parent) {
|
|
221
|
+
parentStack.pop();
|
|
222
|
+
}
|
|
219
223
|
if (ts.isFunctionLike(node)
|
|
220
224
|
|| ts.isCatchClause(node)
|
|
221
225
|
|| (ts.isBlock(node)
|
package/lib/plugins/vue-sfc.js
CHANGED
|
@@ -43,7 +43,7 @@ function create() {
|
|
|
43
43
|
diagnosticProvider: {
|
|
44
44
|
interFileDependencies: false,
|
|
45
45
|
workspaceDiagnostics: false,
|
|
46
|
-
}
|
|
46
|
+
},
|
|
47
47
|
},
|
|
48
48
|
create(context) {
|
|
49
49
|
const htmlServiceInstance = htmlService.create(context);
|
|
@@ -79,7 +79,7 @@ function create() {
|
|
|
79
79
|
const originalResult = await htmlServiceInstance.provideDiagnostics?.(document, token);
|
|
80
80
|
const sfcErrors = [];
|
|
81
81
|
const { template } = sfc;
|
|
82
|
-
const { startTagEnd = Infinity, endTagStart = -Infinity } = template ?? {};
|
|
82
|
+
const { startTagEnd = Infinity, endTagStart = -Infinity, } = template ?? {};
|
|
83
83
|
for (const error of vueSfc.errors) {
|
|
84
84
|
if ('code' in error) {
|
|
85
85
|
const start = error.loc?.start.offset ?? 0;
|
|
@@ -100,7 +100,7 @@ function create() {
|
|
|
100
100
|
}
|
|
101
101
|
return [
|
|
102
102
|
...originalResult ?? [],
|
|
103
|
-
...sfcErrors
|
|
103
|
+
...sfcErrors,
|
|
104
104
|
];
|
|
105
105
|
});
|
|
106
106
|
},
|
|
@@ -278,7 +278,7 @@ function getStyleCompletionItem(styleItem, lang, attr) {
|
|
|
278
278
|
textEdit: styleItem.textEdit ? {
|
|
279
279
|
...styleItem.textEdit,
|
|
280
280
|
newText: styleItem.textEdit.newText + ' lang="' + lang + '"' + (attr ? ` ${attr}` : ''),
|
|
281
|
-
} : undefined
|
|
281
|
+
} : undefined,
|
|
282
282
|
};
|
|
283
283
|
}
|
|
284
284
|
//# sourceMappingURL=vue-sfc.js.map
|
|
@@ -319,7 +319,7 @@ function create(mode, getTsPluginClient) {
|
|
|
319
319
|
for (const directive of directives) {
|
|
320
320
|
const name = (0, language_core_1.hyphenateAttr)(directive);
|
|
321
321
|
attributes.push({
|
|
322
|
-
name
|
|
322
|
+
name,
|
|
323
323
|
});
|
|
324
324
|
}
|
|
325
325
|
const models = [];
|
|
@@ -360,7 +360,7 @@ function create(mode, getTsPluginClient) {
|
|
|
360
360
|
async sync() {
|
|
361
361
|
await Promise.all(promises);
|
|
362
362
|
return version;
|
|
363
|
-
}
|
|
363
|
+
},
|
|
364
364
|
};
|
|
365
365
|
}
|
|
366
366
|
function afterHtmlCompletion(completionList, document) {
|
|
@@ -470,7 +470,7 @@ function create(mode, getTsPluginClient) {
|
|
|
470
470
|
tag: '^',
|
|
471
471
|
prop: propName,
|
|
472
472
|
deprecated: false,
|
|
473
|
-
leadingSlash: false
|
|
473
|
+
leadingSlash: false,
|
|
474
474
|
};
|
|
475
475
|
}
|
|
476
476
|
propInfo = cachedPropInfos.get(propName);
|
|
@@ -597,7 +597,7 @@ function parseLabel(label) {
|
|
|
597
597
|
const name = label.slice(leadingSlash ? 1 : 0);
|
|
598
598
|
return {
|
|
599
599
|
name,
|
|
600
|
-
leadingSlash
|
|
600
|
+
leadingSlash,
|
|
601
601
|
};
|
|
602
602
|
}
|
|
603
603
|
function generateItemKey(type, tag, prop, deprecated) {
|
|
@@ -615,7 +615,7 @@ function parseItemKey(key) {
|
|
|
615
615
|
tag: strs[1],
|
|
616
616
|
prop: strs[2],
|
|
617
617
|
deprecated: strs[3] === '1',
|
|
618
|
-
leadingSlash
|
|
618
|
+
leadingSlash,
|
|
619
619
|
};
|
|
620
620
|
}
|
|
621
621
|
}
|
|
@@ -625,7 +625,7 @@ function getReplacement(list, doc) {
|
|
|
625
625
|
return {
|
|
626
626
|
item: item,
|
|
627
627
|
textEdit: item.textEdit,
|
|
628
|
-
text: doc.getText(item.textEdit.range)
|
|
628
|
+
text: doc.getText(item.textEdit.range),
|
|
629
629
|
};
|
|
630
630
|
}
|
|
631
631
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/language-service",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"files": [
|
|
6
6
|
"data",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@volar/language-service": "2.4.14",
|
|
21
|
-
"@vue/language-core": "3.0.0-beta.
|
|
21
|
+
"@vue/language-core": "3.0.0-beta.3",
|
|
22
22
|
"@vue/shared": "^3.5.0",
|
|
23
23
|
"path-browserify": "^1.0.1",
|
|
24
24
|
"volar-service-css": "0.0.64",
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"@volar/kit": "2.4.14",
|
|
39
39
|
"@volar/typescript": "2.4.14",
|
|
40
40
|
"@vue/compiler-dom": "^3.5.0",
|
|
41
|
-
"@vue/typescript-plugin": "3.0.0-beta.
|
|
41
|
+
"@vue/typescript-plugin": "3.0.0-beta.3",
|
|
42
42
|
"vscode-css-languageservice": "^6.3.1"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "17e3beabc13e9eb59a82fb1a9f0252fd6685e444"
|
|
45
45
|
}
|
|
@@ -82,16 +82,16 @@ const langs = [
|
|
|
82
82
|
},
|
|
83
83
|
];
|
|
84
84
|
|
|
85
|
+
localeWorker();
|
|
85
86
|
for (const lang of langs) {
|
|
86
87
|
if (lang.supported) {
|
|
87
|
-
localeWorker(lang);
|
|
88
88
|
templateWorker(lang);
|
|
89
89
|
sfcWorker(lang);
|
|
90
90
|
modelWorker(lang);
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
function localeWorker(
|
|
94
|
+
function localeWorker() {
|
|
95
95
|
|
|
96
96
|
const data = langs.map(({ name, url }) => ({ name, url }));
|
|
97
97
|
|
|
@@ -417,7 +417,7 @@ async function templateWorker(lang) {
|
|
|
417
417
|
async function fetchText(url, baseUrl) {
|
|
418
418
|
let text = await (await fetch(url)).text();
|
|
419
419
|
text = text.replace(/```vue-html/g, '```html');
|
|
420
|
-
text = text.replace(/\{
|
|
420
|
+
text = text.replace(/\{#.*?\}/g, '')
|
|
421
421
|
text = resolveMarkdownLinks(text, baseUrl);
|
|
422
422
|
return text;
|
|
423
423
|
}
|