@vue/language-service 3.1.0 → 3.1.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.
|
@@ -239,37 +239,37 @@ function getLastImportNode(ts, sourceFile) {
|
|
|
239
239
|
}
|
|
240
240
|
function createAddComponentToOptionEdit(ts, sfc, ast, componentName) {
|
|
241
241
|
const scriptRanges = language_core_1.tsCodegen.get(sfc)?.getScriptRanges();
|
|
242
|
-
if (!scriptRanges?.
|
|
242
|
+
if (!scriptRanges?.componentOptions) {
|
|
243
243
|
return;
|
|
244
244
|
}
|
|
245
|
-
const {
|
|
245
|
+
const { componentOptions } = scriptRanges;
|
|
246
246
|
// https://github.com/microsoft/TypeScript/issues/36174
|
|
247
247
|
const printer = ts.createPrinter();
|
|
248
|
-
if (
|
|
248
|
+
if (componentOptions.components && componentOptions.componentsNode) {
|
|
249
249
|
const newNode = {
|
|
250
|
-
...
|
|
250
|
+
...componentOptions.componentsNode,
|
|
251
251
|
properties: [
|
|
252
|
-
...
|
|
252
|
+
...componentOptions.componentsNode.properties,
|
|
253
253
|
ts.factory.createShorthandPropertyAssignment(componentName),
|
|
254
254
|
],
|
|
255
255
|
};
|
|
256
256
|
const printText = printer.printNode(ts.EmitHint.Expression, newNode, ast);
|
|
257
257
|
return {
|
|
258
|
-
range:
|
|
258
|
+
range: componentOptions.components,
|
|
259
259
|
newText: unescape(printText.replace(unicodeReg, '%u')),
|
|
260
260
|
};
|
|
261
261
|
}
|
|
262
262
|
else {
|
|
263
263
|
const newNode = {
|
|
264
|
-
...
|
|
264
|
+
...componentOptions.argsNode,
|
|
265
265
|
properties: [
|
|
266
|
-
...
|
|
266
|
+
...componentOptions.argsNode.properties,
|
|
267
267
|
ts.factory.createShorthandPropertyAssignment(`components: { ${componentName} }`),
|
|
268
268
|
],
|
|
269
269
|
};
|
|
270
270
|
const printText = printer.printNode(ts.EmitHint.Expression, newNode, ast);
|
|
271
271
|
return {
|
|
272
|
-
range:
|
|
272
|
+
range: componentOptions.args,
|
|
273
273
|
newText: unescape(printText.replace(unicodeReg, '%u')),
|
|
274
274
|
};
|
|
275
275
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/language-service",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.2",
|
|
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.23",
|
|
21
|
-
"@vue/language-core": "3.1.
|
|
21
|
+
"@vue/language-core": "3.1.2",
|
|
22
22
|
"@vue/shared": "^3.5.0",
|
|
23
23
|
"path-browserify": "^1.0.1",
|
|
24
24
|
"volar-service-css": "0.0.65",
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"@volar/kit": "2.4.23",
|
|
38
38
|
"@volar/typescript": "2.4.23",
|
|
39
39
|
"@vue/compiler-dom": "^3.5.0",
|
|
40
|
-
"@vue/typescript-plugin": "3.1.
|
|
40
|
+
"@vue/typescript-plugin": "3.1.2",
|
|
41
41
|
"vscode-css-languageservice": "^6.3.1"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "77db3d889305e8c02740f4c14793bff0156ccdb8"
|
|
44
44
|
}
|