@vue/typescript-plugin 3.0.3 → 3.0.4
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 +14 -10
- package/lib/common.d.ts +1 -1
- package/lib/common.js +10 -10
- package/lib/requests/collectExtractProps.js +3 -3
- package/lib/requests/getComponentDirectives.js +2 -2
- package/lib/requests/getComponentEvents.js +2 -2
- package/lib/requests/getComponentNames.js +2 -2
- package/lib/requests/getComponentProps.d.ts +1 -1
- package/lib/requests/getComponentProps.js +7 -7
- package/lib/requests/getComponentSlots.d.ts +2 -0
- package/lib/requests/getComponentSlots.js +24 -0
- package/lib/requests/getElementAttrs.js +2 -2
- package/lib/requests/getElementNames.js +2 -2
- package/lib/requests/getMissingPropsDiagnostics.d.ts +10 -0
- package/lib/requests/getMissingPropsDiagnostics.js +40 -0
- package/lib/requests/getPropertiesAtLocation.js +3 -5
- package/lib/requests/index.d.ts +4 -2
- package/lib/requests/types.d.ts +2 -4
- package/package.json +3 -3
package/index.js
CHANGED
|
@@ -7,6 +7,7 @@ const getComponentDirectives_1 = require("./lib/requests/getComponentDirectives"
|
|
|
7
7
|
const getComponentEvents_1 = require("./lib/requests/getComponentEvents");
|
|
8
8
|
const getComponentNames_1 = require("./lib/requests/getComponentNames");
|
|
9
9
|
const getComponentProps_1 = require("./lib/requests/getComponentProps");
|
|
10
|
+
const getComponentSlots_1 = require("./lib/requests/getComponentSlots");
|
|
10
11
|
const getElementAttrs_1 = require("./lib/requests/getElementAttrs");
|
|
11
12
|
const getElementNames_1 = require("./lib/requests/getElementNames");
|
|
12
13
|
const getImportPathForFile_1 = require("./lib/requests/getImportPathForFile");
|
|
@@ -22,7 +23,7 @@ module.exports = (0, createLanguageServicePlugin_1.createLanguageServicePlugin)(
|
|
|
22
23
|
languagePlugins: [languagePlugin],
|
|
23
24
|
setup: language => {
|
|
24
25
|
project2Service.set(info.project, [language, info.languageServiceHost, info.languageService]);
|
|
25
|
-
info.languageService = (0, common_1.createVueLanguageServiceProxy)(ts, language, info.languageService, vueOptions
|
|
26
|
+
info.languageService = (0, common_1.createVueLanguageServiceProxy)(ts, language, info.languageService, vueOptions);
|
|
26
27
|
// #3963
|
|
27
28
|
const timer = setInterval(() => {
|
|
28
29
|
if (info.project['program']) {
|
|
@@ -86,6 +87,16 @@ module.exports = (0, createLanguageServicePlugin_1.createLanguageServicePlugin)(
|
|
|
86
87
|
response: getPropertiesAtLocation_1.getPropertiesAtLocation.apply(getRequestContext(args[0]), args),
|
|
87
88
|
};
|
|
88
89
|
});
|
|
90
|
+
session.addProtocolHandler('_vue:getComponentDirectives', ({ arguments: args }) => {
|
|
91
|
+
return {
|
|
92
|
+
response: getComponentDirectives_1.getComponentDirectives.apply(getRequestContext(args[0]), args),
|
|
93
|
+
};
|
|
94
|
+
});
|
|
95
|
+
session.addProtocolHandler('_vue:getComponentEvents', ({ arguments: args }) => {
|
|
96
|
+
return {
|
|
97
|
+
response: getComponentEvents_1.getComponentEvents.apply(getRequestContext(args[0]), args),
|
|
98
|
+
};
|
|
99
|
+
});
|
|
89
100
|
session.addProtocolHandler('_vue:getComponentNames', ({ arguments: args }) => {
|
|
90
101
|
return {
|
|
91
102
|
response: getComponentNames_1.getComponentNames.apply(getRequestContext(args[0]), args) ?? [],
|
|
@@ -96,14 +107,9 @@ module.exports = (0, createLanguageServicePlugin_1.createLanguageServicePlugin)(
|
|
|
96
107
|
response: getComponentProps_1.getComponentProps.apply(getRequestContext(args[0]), args),
|
|
97
108
|
};
|
|
98
109
|
});
|
|
99
|
-
session.addProtocolHandler('_vue:
|
|
100
|
-
return {
|
|
101
|
-
response: getComponentEvents_1.getComponentEvents.apply(getRequestContext(args[0]), args),
|
|
102
|
-
};
|
|
103
|
-
});
|
|
104
|
-
session.addProtocolHandler('_vue:getComponentDirectives', ({ arguments: args }) => {
|
|
110
|
+
session.addProtocolHandler('_vue:getComponentSlots', ({ arguments: args }) => {
|
|
105
111
|
return {
|
|
106
|
-
response:
|
|
112
|
+
response: getComponentSlots_1.getComponentSlots.apply(getRequestContext(args[0]), args),
|
|
107
113
|
};
|
|
108
114
|
});
|
|
109
115
|
session.addProtocolHandler('_vue:getElementAttrs', ({ arguments: args }) => {
|
|
@@ -132,8 +138,6 @@ module.exports = (0, createLanguageServicePlugin_1.createLanguageServicePlugin)(
|
|
|
132
138
|
languageService: service[2],
|
|
133
139
|
languageServiceHost: service[1],
|
|
134
140
|
language: service[0],
|
|
135
|
-
isTsPlugin: true,
|
|
136
|
-
asScriptId: (fileName) => fileName,
|
|
137
141
|
};
|
|
138
142
|
}
|
|
139
143
|
});
|
package/lib/common.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { type Language, type VueCompilerOptions } from '@vue/language-core';
|
|
2
2
|
import type * as ts from 'typescript';
|
|
3
|
-
export declare function createVueLanguageServiceProxy
|
|
3
|
+
export declare function createVueLanguageServiceProxy(ts: typeof import('typescript'), language: Language<string>, languageService: ts.LanguageService, vueOptions: VueCompilerOptions): ts.LanguageService;
|
package/lib/common.js
CHANGED
|
@@ -4,18 +4,18 @@ exports.createVueLanguageServiceProxy = createVueLanguageServiceProxy;
|
|
|
4
4
|
const language_core_1 = require("@vue/language-core");
|
|
5
5
|
const shared_1 = require("@vue/shared");
|
|
6
6
|
const windowsPathReg = /\\/g;
|
|
7
|
-
function createVueLanguageServiceProxy(ts, language, languageService, vueOptions
|
|
7
|
+
function createVueLanguageServiceProxy(ts, language, languageService, vueOptions) {
|
|
8
8
|
const proxyCache = new Map();
|
|
9
9
|
const getProxyMethod = (target, p) => {
|
|
10
10
|
switch (p) {
|
|
11
11
|
case 'getCompletionsAtPosition':
|
|
12
|
-
return getCompletionsAtPosition(ts, language, vueOptions,
|
|
12
|
+
return getCompletionsAtPosition(ts, language, vueOptions, target[p]);
|
|
13
13
|
case 'getCompletionEntryDetails':
|
|
14
|
-
return getCompletionEntryDetails(language,
|
|
14
|
+
return getCompletionEntryDetails(language, target[p]);
|
|
15
15
|
case 'getCodeFixesAtPosition':
|
|
16
16
|
return getCodeFixesAtPosition(target[p]);
|
|
17
17
|
case 'getDefinitionAndBoundSpan':
|
|
18
|
-
return getDefinitionAndBoundSpan(ts, language, languageService, vueOptions,
|
|
18
|
+
return getDefinitionAndBoundSpan(ts, language, languageService, vueOptions, target[p]);
|
|
19
19
|
}
|
|
20
20
|
};
|
|
21
21
|
return new Proxy(languageService, {
|
|
@@ -36,7 +36,7 @@ function createVueLanguageServiceProxy(ts, language, languageService, vueOptions
|
|
|
36
36
|
},
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
|
-
function getCompletionsAtPosition(ts, language, vueOptions,
|
|
39
|
+
function getCompletionsAtPosition(ts, language, vueOptions, getCompletionsAtPosition) {
|
|
40
40
|
return (filePath, position, options, formattingSettings) => {
|
|
41
41
|
const fileName = filePath.replace(windowsPathReg, '/');
|
|
42
42
|
const result = getCompletionsAtPosition(fileName, position, options, formattingSettings);
|
|
@@ -45,7 +45,7 @@ function getCompletionsAtPosition(ts, language, vueOptions, asScriptId, getCompl
|
|
|
45
45
|
result.entries = result.entries.filter(entry => !entry.name.includes('__VLS_')
|
|
46
46
|
&& !entry.labelDetails?.description?.includes('__VLS_'));
|
|
47
47
|
// filter global variables in template and styles
|
|
48
|
-
const sourceScript = language.scripts.get(
|
|
48
|
+
const sourceScript = language.scripts.get(fileName);
|
|
49
49
|
const root = sourceScript?.generated?.root;
|
|
50
50
|
if (root instanceof language_core_1.VueVirtualCode) {
|
|
51
51
|
const blocks = [
|
|
@@ -105,7 +105,7 @@ function getCompletionsAtPosition(ts, language, vueOptions, asScriptId, getCompl
|
|
|
105
105
|
return result;
|
|
106
106
|
};
|
|
107
107
|
}
|
|
108
|
-
function getCompletionEntryDetails(language,
|
|
108
|
+
function getCompletionEntryDetails(language, getCompletionEntryDetails) {
|
|
109
109
|
return (...args) => {
|
|
110
110
|
const details = getCompletionEntryDetails(...args);
|
|
111
111
|
// modify import statement
|
|
@@ -125,7 +125,7 @@ function getCompletionEntryDetails(language, asScriptId, getCompletionEntryDetai
|
|
|
125
125
|
if (args[6]?.__isAutoImport) {
|
|
126
126
|
// @ts-expect-error
|
|
127
127
|
const { fileName } = args[6].__isAutoImport;
|
|
128
|
-
const sourceScript = language.scripts.get(
|
|
128
|
+
const sourceScript = language.scripts.get(fileName);
|
|
129
129
|
if (sourceScript?.generated?.root instanceof language_core_1.VueVirtualCode) {
|
|
130
130
|
const sfc = sourceScript.generated.root.vueSfc;
|
|
131
131
|
if (!sfc?.descriptor.script && !sfc?.descriptor.scriptSetup) {
|
|
@@ -153,14 +153,14 @@ function getCodeFixesAtPosition(getCodeFixesAtPosition) {
|
|
|
153
153
|
return result;
|
|
154
154
|
};
|
|
155
155
|
}
|
|
156
|
-
function getDefinitionAndBoundSpan(ts, language, languageService, vueOptions,
|
|
156
|
+
function getDefinitionAndBoundSpan(ts, language, languageService, vueOptions, getDefinitionAndBoundSpan) {
|
|
157
157
|
return (fileName, position) => {
|
|
158
158
|
const result = getDefinitionAndBoundSpan(fileName, position);
|
|
159
159
|
if (!result?.definitions?.length) {
|
|
160
160
|
return result;
|
|
161
161
|
}
|
|
162
162
|
const program = languageService.getProgram();
|
|
163
|
-
const sourceScript = language.scripts.get(
|
|
163
|
+
const sourceScript = language.scripts.get(fileName);
|
|
164
164
|
if (!sourceScript?.generated) {
|
|
165
165
|
return result;
|
|
166
166
|
}
|
|
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.collectExtractProps = collectExtractProps;
|
|
4
4
|
const language_core_1 = require("@vue/language-core");
|
|
5
5
|
function collectExtractProps(fileName, templateCodeRange) {
|
|
6
|
-
const { typescript: ts, languageService, language
|
|
7
|
-
const sourceScript = language.scripts.get(
|
|
6
|
+
const { typescript: ts, languageService, language } = this;
|
|
7
|
+
const sourceScript = language.scripts.get(fileName);
|
|
8
8
|
if (!sourceScript?.generated) {
|
|
9
9
|
return;
|
|
10
10
|
}
|
|
@@ -27,7 +27,7 @@ function collectExtractProps(fileName, templateCodeRange) {
|
|
|
27
27
|
const { name } = node;
|
|
28
28
|
for (const map of maps) {
|
|
29
29
|
let mapped = false;
|
|
30
|
-
for (const source of map.toSourceLocation(name.getEnd() -
|
|
30
|
+
for (const source of map.toSourceLocation(name.getEnd() - sourceScript.snapshot.getLength())) {
|
|
31
31
|
if (source[0] >= sfc.template.startTagEnd + templateCodeRange[0]
|
|
32
32
|
&& source[0] <= sfc.template.startTagEnd + templateCodeRange[1]
|
|
33
33
|
&& (0, language_core_1.isSemanticTokensEnabled)(source[1].data)) {
|
|
@@ -12,8 +12,8 @@ const builtInDirectives = new Set([
|
|
|
12
12
|
'vSlot',
|
|
13
13
|
]);
|
|
14
14
|
function getComponentDirectives(fileName) {
|
|
15
|
-
const { typescript: ts, language, languageService
|
|
16
|
-
const volarFile = language.scripts.get(
|
|
15
|
+
const { typescript: ts, language, languageService } = this;
|
|
16
|
+
const volarFile = language.scripts.get(fileName);
|
|
17
17
|
if (!(volarFile?.generated?.root instanceof language_core_1.VueVirtualCode)) {
|
|
18
18
|
return;
|
|
19
19
|
}
|
|
@@ -4,8 +4,8 @@ exports.getComponentEvents = getComponentEvents;
|
|
|
4
4
|
const language_core_1 = require("@vue/language-core");
|
|
5
5
|
const utils_1 = require("./utils");
|
|
6
6
|
function getComponentEvents(fileName, tag) {
|
|
7
|
-
const { typescript: ts, language, languageService
|
|
8
|
-
const volarFile = language.scripts.get(
|
|
7
|
+
const { typescript: ts, language, languageService } = this;
|
|
8
|
+
const volarFile = language.scripts.get(fileName);
|
|
9
9
|
if (!(volarFile?.generated?.root instanceof language_core_1.VueVirtualCode)) {
|
|
10
10
|
return;
|
|
11
11
|
}
|
|
@@ -5,8 +5,8 @@ exports._getComponentNames = _getComponentNames;
|
|
|
5
5
|
const language_core_1 = require("@vue/language-core");
|
|
6
6
|
const utils_1 = require("./utils");
|
|
7
7
|
function getComponentNames(fileName) {
|
|
8
|
-
const { typescript: ts, language, languageService
|
|
9
|
-
const volarFile = language.scripts.get(
|
|
8
|
+
const { typescript: ts, language, languageService } = this;
|
|
9
|
+
const volarFile = language.scripts.get(fileName);
|
|
10
10
|
if (!(volarFile?.generated?.root instanceof language_core_1.VueVirtualCode)) {
|
|
11
11
|
return;
|
|
12
12
|
}
|
|
@@ -4,7 +4,7 @@ export interface ComponentPropInfo {
|
|
|
4
4
|
required?: boolean;
|
|
5
5
|
deprecated?: boolean;
|
|
6
6
|
isAttribute?: boolean;
|
|
7
|
-
|
|
7
|
+
documentation?: string;
|
|
8
8
|
values?: string[];
|
|
9
9
|
}
|
|
10
10
|
export declare function getComponentProps(this: RequestContext, fileName: string, tag: string): ComponentPropInfo[] | undefined;
|
|
@@ -4,8 +4,8 @@ exports.getComponentProps = getComponentProps;
|
|
|
4
4
|
const language_core_1 = require("@vue/language-core");
|
|
5
5
|
const utils_1 = require("./utils");
|
|
6
6
|
function getComponentProps(fileName, tag) {
|
|
7
|
-
const { typescript: ts, language, languageService
|
|
8
|
-
const volarFile = language.scripts.get(
|
|
7
|
+
const { typescript: ts, language, languageService } = this;
|
|
8
|
+
const volarFile = language.scripts.get(fileName);
|
|
9
9
|
if (!(volarFile?.generated?.root instanceof language_core_1.VueVirtualCode)) {
|
|
10
10
|
return;
|
|
11
11
|
}
|
|
@@ -49,7 +49,7 @@ function getComponentProps(fileName, tag) {
|
|
|
49
49
|
}
|
|
50
50
|
const name = prop.name;
|
|
51
51
|
const required = !(prop.flags & ts.SymbolFlags.Optional) || undefined;
|
|
52
|
-
const {
|
|
52
|
+
const { documentation, deprecated, } = generateDocumentation(prop.getDocumentationComment(checker), prop.getJsDocTags());
|
|
53
53
|
const values = [];
|
|
54
54
|
const type = checker.getTypeOfSymbol(prop);
|
|
55
55
|
const subTypes = type.types;
|
|
@@ -79,18 +79,18 @@ function getComponentProps(fileName, tag) {
|
|
|
79
79
|
required,
|
|
80
80
|
deprecated,
|
|
81
81
|
isAttribute,
|
|
82
|
-
|
|
82
|
+
documentation,
|
|
83
83
|
values,
|
|
84
84
|
});
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
|
-
function
|
|
87
|
+
function generateDocumentation(parts, jsDocTags) {
|
|
88
88
|
const parsedComment = _symbolDisplayPartsToMarkdown(parts);
|
|
89
89
|
const parsedJsDoc = _jsDocTagInfoToMarkdown(jsDocTags);
|
|
90
|
-
const
|
|
90
|
+
const documentation = [parsedComment, parsedJsDoc].filter(str => !!str).join('\n\n');
|
|
91
91
|
const deprecated = jsDocTags.some(tag => tag.name === 'deprecated');
|
|
92
92
|
return {
|
|
93
|
-
|
|
93
|
+
documentation,
|
|
94
94
|
deprecated,
|
|
95
95
|
};
|
|
96
96
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getComponentSlots = getComponentSlots;
|
|
4
|
+
const language_core_1 = require("@vue/language-core");
|
|
5
|
+
const utils_1 = require("./utils");
|
|
6
|
+
function getComponentSlots(fileName) {
|
|
7
|
+
const { typescript: ts, language, languageService } = this;
|
|
8
|
+
const volarFile = language.scripts.get(fileName);
|
|
9
|
+
if (!(volarFile?.generated?.root instanceof language_core_1.VueVirtualCode)) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
const vueCode = volarFile.generated.root;
|
|
13
|
+
const codegen = language_core_1.tsCodegen.get(vueCode.sfc);
|
|
14
|
+
if (!codegen) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
const assignName = codegen.getSetupSlotsAssignName() ?? `__VLS_slots`;
|
|
18
|
+
const slots = (0, utils_1.getVariableType)(ts, languageService, vueCode, assignName);
|
|
19
|
+
if (!slots) {
|
|
20
|
+
return [];
|
|
21
|
+
}
|
|
22
|
+
return slots.type.getProperties().map(({ name }) => name);
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=getComponentSlots.js.map
|
|
@@ -4,8 +4,8 @@ exports.getElementAttrs = getElementAttrs;
|
|
|
4
4
|
const language_core_1 = require("@vue/language-core");
|
|
5
5
|
const utils_1 = require("./utils");
|
|
6
6
|
function getElementAttrs(fileName, tagName) {
|
|
7
|
-
const { typescript: ts, language, languageService
|
|
8
|
-
const volarFile = language.scripts.get(
|
|
7
|
+
const { typescript: ts, language, languageService } = this;
|
|
8
|
+
const volarFile = language.scripts.get(fileName);
|
|
9
9
|
if (!(volarFile?.generated?.root instanceof language_core_1.VueVirtualCode)) {
|
|
10
10
|
return;
|
|
11
11
|
}
|
|
@@ -5,8 +5,8 @@ exports._getElementNames = _getElementNames;
|
|
|
5
5
|
const language_core_1 = require("@vue/language-core");
|
|
6
6
|
const utils_1 = require("./utils");
|
|
7
7
|
function getElementNames(fileName) {
|
|
8
|
-
const { typescript: ts, language, languageService
|
|
9
|
-
const volarFile = language.scripts.get(
|
|
8
|
+
const { typescript: ts, language, languageService } = this;
|
|
9
|
+
const volarFile = language.scripts.get(fileName);
|
|
10
10
|
if (!(volarFile?.generated?.root instanceof language_core_1.VueVirtualCode)) {
|
|
11
11
|
return;
|
|
12
12
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { RequestContext } from './types';
|
|
2
|
+
export interface ComponentPropInfo {
|
|
3
|
+
name: string;
|
|
4
|
+
required?: boolean;
|
|
5
|
+
deprecated?: boolean;
|
|
6
|
+
isAttribute?: boolean;
|
|
7
|
+
commentMarkdown?: string;
|
|
8
|
+
values?: string[];
|
|
9
|
+
}
|
|
10
|
+
export declare function getMissingPropsDiagnostics(this: RequestContext, fileName: string): undefined;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getMissingPropsDiagnostics = getMissingPropsDiagnostics;
|
|
4
|
+
const language_core_1 = require("@vue/language-core");
|
|
5
|
+
function getMissingPropsDiagnostics(fileName) {
|
|
6
|
+
const { typescript: ts, language, languageService, asScriptId } = this;
|
|
7
|
+
const volarFile = language.scripts.get(asScriptId(fileName));
|
|
8
|
+
if (!(volarFile?.generated?.root instanceof language_core_1.VueVirtualCode)) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
const vueCode = volarFile.generated.root;
|
|
12
|
+
const program = languageService.getProgram();
|
|
13
|
+
const sourceFile = program.getSourceFile(vueCode.fileName);
|
|
14
|
+
if (!sourceFile) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
const checker = program.getTypeChecker();
|
|
18
|
+
ts.forEachChild(sourceFile, function visit(node) {
|
|
19
|
+
if (ts.isVariableDeclaration(node)
|
|
20
|
+
&& node.initializer
|
|
21
|
+
&& ts.isCallExpression(node.initializer)
|
|
22
|
+
&& ts.isIdentifier(node.initializer.expression)
|
|
23
|
+
&& /^__VLS_\d+$/.test(node.initializer.expression.text)) {
|
|
24
|
+
const firstArg = node.initializer.arguments[0];
|
|
25
|
+
const type = checker.getTypeAtLocation(firstArg);
|
|
26
|
+
const contextualType = checker.getContextualType(firstArg);
|
|
27
|
+
if (contextualType) {
|
|
28
|
+
const subtype = contextualType.isUnion()
|
|
29
|
+
? contextualType.types.find(subtype => checker.isTypeAssignableTo(subtype, type))
|
|
30
|
+
: contextualType;
|
|
31
|
+
void subtype;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
ts.forEachChild(node, visit);
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=getMissingPropsDiagnostics.js.map
|
|
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
exports.getPropertiesAtLocation = getPropertiesAtLocation;
|
|
5
5
|
const language_core_1 = require("@vue/language-core");
|
|
6
6
|
function getPropertiesAtLocation(fileName, position) {
|
|
7
|
-
const { languageService, language, typescript: ts
|
|
7
|
+
const { languageService, language, typescript: ts } = this;
|
|
8
8
|
// mapping
|
|
9
|
-
const file = language.scripts.get(
|
|
9
|
+
const file = language.scripts.get(fileName);
|
|
10
10
|
if (file?.generated) {
|
|
11
11
|
const virtualScript = file.generated.languagePlugin.typescript?.getServiceScript(file.generated.root);
|
|
12
12
|
if (!virtualScript) {
|
|
@@ -28,9 +28,7 @@ function getPropertiesAtLocation(fileName, position) {
|
|
|
28
28
|
if (!mapped) {
|
|
29
29
|
return;
|
|
30
30
|
}
|
|
31
|
-
|
|
32
|
-
position += file.snapshot.getLength();
|
|
33
|
-
}
|
|
31
|
+
position += file.snapshot.getLength();
|
|
34
32
|
}
|
|
35
33
|
const program = languageService.getProgram();
|
|
36
34
|
const sourceFile = program.getSourceFile(fileName);
|
package/lib/requests/index.d.ts
CHANGED
|
@@ -4,12 +4,14 @@ export type Requests = {
|
|
|
4
4
|
collectExtractProps: ToRequest<typeof import('./collectExtractProps.js')['collectExtractProps']>;
|
|
5
5
|
getImportPathForFile: ToRequest<typeof import('./getImportPathForFile.js')['getImportPathForFile']>;
|
|
6
6
|
getPropertiesAtLocation: ToRequest<typeof import('./getPropertiesAtLocation.js')['getPropertiesAtLocation']>;
|
|
7
|
+
getComponentDirectives: ToRequest<typeof import('./getComponentDirectives.js')['getComponentDirectives']>;
|
|
8
|
+
getComponentEvents: ToRequest<typeof import('./getComponentEvents.js')['getComponentEvents']>;
|
|
7
9
|
getComponentNames: ToRequest<typeof import('./getComponentNames.js')['getComponentNames']>;
|
|
8
10
|
getComponentProps: ToRequest<typeof import('./getComponentProps.js')['getComponentProps']>;
|
|
9
|
-
|
|
10
|
-
getComponentDirectives: ToRequest<typeof import('./getComponentDirectives.js')['getComponentDirectives']>;
|
|
11
|
+
getComponentSlots: ToRequest<typeof import('./getComponentSlots.js')['getComponentSlots']>;
|
|
11
12
|
getElementAttrs: ToRequest<typeof import('./getElementAttrs.js')['getElementAttrs']>;
|
|
12
13
|
getElementNames: ToRequest<typeof import('./getElementNames.js')['getElementNames']>;
|
|
14
|
+
getDocumentHighlights: ToRequest<(fileName: string, position: number) => ts.DocumentHighlights[]>;
|
|
13
15
|
getEncodedSemanticClassifications: ToRequest<(fileName: string, span: ts.TextSpan) => ts.Classifications>;
|
|
14
16
|
getQuickInfoAtPosition: ToRequest<(fileName: string, position: ts.LineAndCharacter) => string>;
|
|
15
17
|
};
|
package/lib/requests/types.d.ts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import type { Language } from '@vue/language-core';
|
|
2
2
|
import type * as ts from 'typescript';
|
|
3
|
-
export interface RequestContext
|
|
3
|
+
export interface RequestContext {
|
|
4
4
|
typescript: typeof ts;
|
|
5
5
|
languageService: ts.LanguageService;
|
|
6
6
|
languageServiceHost: ts.LanguageServiceHost;
|
|
7
|
-
language: Language<
|
|
8
|
-
isTsPlugin: boolean;
|
|
9
|
-
asScriptId: (fileName: string) => T;
|
|
7
|
+
language: Language<string>;
|
|
10
8
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/typescript-plugin",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"files": [
|
|
6
6
|
"**/*.js",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@volar/typescript": "2.4.20",
|
|
17
|
-
"@vue/language-core": "3.0.
|
|
17
|
+
"@vue/language-core": "3.0.4",
|
|
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": "148d386f9779c2de64cdcbd35310e03b36943b05"
|
|
26
26
|
}
|