@vue/typescript-plugin 3.0.0-beta.5 → 3.0.1
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/lib/common.js +0 -40
- package/lib/requests/getCurrentComponentSlots.d.ts +1 -0
- package/lib/requests/getCurrentComponentSlots.js +3 -0
- package/lib/requests/getDefineSlotNames.d.ts +1 -0
- package/lib/requests/getDefineSlotNames.js +3 -0
- package/lib/requests/getDefineSlots.d.ts +2 -0
- package/lib/requests/getDefineSlots.js +16 -0
- package/package.json +4 -4
package/lib/common.js
CHANGED
|
@@ -18,8 +18,6 @@ function createVueLanguageServiceProxy(ts, language, languageService, vueOptions
|
|
|
18
18
|
return getCodeFixesAtPosition(target[p]);
|
|
19
19
|
case 'getDefinitionAndBoundSpan':
|
|
20
20
|
return getDefinitionAndBoundSpan(ts, language, languageService, vueOptions, asScriptId, target[p]);
|
|
21
|
-
case 'getQuickInfoAtPosition':
|
|
22
|
-
return getQuickInfoAtPosition(ts, target, target[p]);
|
|
23
21
|
// TS plugin only
|
|
24
22
|
case 'getEncodedSemanticClassifications':
|
|
25
23
|
return getEncodedSemanticClassifications(ts, language, target, asScriptId, target[p]);
|
|
@@ -239,44 +237,6 @@ function getDefinitionAndBoundSpan(ts, language, languageService, vueOptions, as
|
|
|
239
237
|
}
|
|
240
238
|
};
|
|
241
239
|
}
|
|
242
|
-
function getQuickInfoAtPosition(ts, languageService, getQuickInfoAtPosition) {
|
|
243
|
-
return (...args) => {
|
|
244
|
-
const result = getQuickInfoAtPosition(...args);
|
|
245
|
-
if (result && result.documentation?.length === 1 && result.documentation[0].text.startsWith('__VLS_emit,')) {
|
|
246
|
-
const [_, emitVarName, eventName] = result.documentation[0].text.split(',');
|
|
247
|
-
const program = languageService.getProgram();
|
|
248
|
-
const typeChecker = program.getTypeChecker();
|
|
249
|
-
const sourceFile = program.getSourceFile(args[0]);
|
|
250
|
-
result.documentation = undefined;
|
|
251
|
-
let symbolNode;
|
|
252
|
-
sourceFile?.forEachChild(function visit(node) {
|
|
253
|
-
if (ts.isIdentifier(node) && node.text === emitVarName) {
|
|
254
|
-
symbolNode = node;
|
|
255
|
-
}
|
|
256
|
-
if (symbolNode) {
|
|
257
|
-
return;
|
|
258
|
-
}
|
|
259
|
-
ts.forEachChild(node, visit);
|
|
260
|
-
});
|
|
261
|
-
if (symbolNode) {
|
|
262
|
-
const emitSymbol = typeChecker.getSymbolAtLocation(symbolNode);
|
|
263
|
-
if (emitSymbol) {
|
|
264
|
-
const type = typeChecker.getTypeOfSymbolAtLocation(emitSymbol, symbolNode);
|
|
265
|
-
const calls = type.getCallSignatures();
|
|
266
|
-
for (const call of calls) {
|
|
267
|
-
const callEventName = typeChecker.getTypeOfSymbolAtLocation(call.parameters[0], symbolNode).value;
|
|
268
|
-
call.getJsDocTags();
|
|
269
|
-
if (callEventName === eventName) {
|
|
270
|
-
result.documentation = call.getDocumentationComment(typeChecker);
|
|
271
|
-
result.tags = call.getJsDocTags();
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
return result;
|
|
278
|
-
};
|
|
279
|
-
}
|
|
280
240
|
function getEncodedSemanticClassifications(ts, language, languageService, asScriptId, getEncodedSemanticClassifications) {
|
|
281
241
|
return (filePath, span, format) => {
|
|
282
242
|
const fileName = filePath.replace(windowsPathReg, '/');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getDefineSlots = getDefineSlots;
|
|
4
|
+
const language_core_1 = require("@vue/language-core");
|
|
5
|
+
const utils_1 = require("./utils");
|
|
6
|
+
function getDefineSlots(fileName) {
|
|
7
|
+
const { typescript: ts, language, languageService, getFileId } = this;
|
|
8
|
+
const volarFile = language.scripts.get(getFileId(fileName));
|
|
9
|
+
if (!(volarFile?.generated?.root instanceof language_core_1.VueVirtualCode)) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
const vueCode = volarFile.generated.root;
|
|
13
|
+
const slots = (0, utils_1.getTypeAliasType)(ts, languageService, vueCode, '__VLS_Slots');
|
|
14
|
+
return slots?.type.getProperties().map(prop => prop.getName());
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=getDefineSlots.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/typescript-plugin",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"files": [
|
|
6
6
|
"**/*.js",
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
"directory": "packages/typescript-plugin"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@volar/typescript": "2.4.
|
|
17
|
-
"@vue/language-core": "3.0.
|
|
16
|
+
"@volar/typescript": "2.4.17",
|
|
17
|
+
"@vue/language-core": "3.0.1",
|
|
18
18
|
"@vue/shared": "^3.5.0",
|
|
19
19
|
"path-browserify": "^1.0.1"
|
|
20
20
|
},
|
|
@@ -22,5 +22,5 @@
|
|
|
22
22
|
"@types/node": "^22.10.4",
|
|
23
23
|
"@types/path-browserify": "^1.0.1"
|
|
24
24
|
},
|
|
25
|
-
"gitHead": "
|
|
25
|
+
"gitHead": "43884409838dfdce44de51f6622926ac6ddd7318"
|
|
26
26
|
}
|