@vue/typescript-plugin 3.0.7-alpha.0 → 3.0.7-alpha.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/index.js
CHANGED
|
@@ -76,7 +76,7 @@ module.exports = (0, createLanguageServicePlugin_1.createLanguageServicePlugin)(
|
|
|
76
76
|
const [fileName, templateCodeRange] = request.arguments;
|
|
77
77
|
const { language, program, sourceScript, virtualCode } = getLanguageServiceAndVirtualCode(fileName);
|
|
78
78
|
return {
|
|
79
|
-
response: (0, collectExtractProps_1.collectExtractProps)(ts, language, program, sourceScript, virtualCode, templateCodeRange),
|
|
79
|
+
response: (0, collectExtractProps_1.collectExtractProps)(ts, language, program, sourceScript, virtualCode, templateCodeRange, true),
|
|
80
80
|
};
|
|
81
81
|
});
|
|
82
82
|
session.addProtocolHandler('_vue:getImportPathForFile', request => {
|
|
@@ -90,7 +90,7 @@ module.exports = (0, createLanguageServicePlugin_1.createLanguageServicePlugin)(
|
|
|
90
90
|
const [fileName, position] = request.arguments;
|
|
91
91
|
const { language, program, sourceScript, virtualCode } = getLanguageServiceAndVirtualCode(fileName);
|
|
92
92
|
return {
|
|
93
|
-
response: (0, getPropertiesAtLocation_1.getPropertiesAtLocation)(ts, language, program, sourceScript, virtualCode, position),
|
|
93
|
+
response: (0, getPropertiesAtLocation_1.getPropertiesAtLocation)(ts, language, program, sourceScript, virtualCode, position, true),
|
|
94
94
|
};
|
|
95
95
|
});
|
|
96
96
|
session.addProtocolHandler('_vue:getComponentDirectives', request => {
|
|
@@ -5,5 +5,5 @@ interface ExtractPropsInfo {
|
|
|
5
5
|
type: string;
|
|
6
6
|
model: boolean;
|
|
7
7
|
}
|
|
8
|
-
export declare function collectExtractProps(ts: typeof import('typescript'), language: Language, program: ts.Program, sourceScript: SourceScript, virtualCode: VueVirtualCode, templateCodeRange: [number, number]): ExtractPropsInfo[];
|
|
8
|
+
export declare function collectExtractProps(ts: typeof import('typescript'), language: Language, program: ts.Program, sourceScript: SourceScript, virtualCode: VueVirtualCode, templateCodeRange: [number, number], isTsPlugin: boolean): ExtractPropsInfo[];
|
|
9
9
|
export {};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.collectExtractProps = collectExtractProps;
|
|
4
4
|
const language_core_1 = require("@vue/language-core");
|
|
5
|
-
function collectExtractProps(ts, language, program, sourceScript, virtualCode, templateCodeRange) {
|
|
5
|
+
function collectExtractProps(ts, language, program, sourceScript, virtualCode, templateCodeRange, isTsPlugin) {
|
|
6
6
|
const result = new Map();
|
|
7
7
|
const sourceFile = program.getSourceFile(virtualCode.fileName);
|
|
8
8
|
const checker = program.getTypeChecker();
|
|
@@ -17,7 +17,7 @@ function collectExtractProps(ts, language, program, sourceScript, virtualCode, t
|
|
|
17
17
|
const { name } = node;
|
|
18
18
|
for (const map of maps) {
|
|
19
19
|
let mapped = false;
|
|
20
|
-
for (const source of map.toSourceLocation(name.getEnd() - sourceScript.snapshot.getLength())) {
|
|
20
|
+
for (const source of map.toSourceLocation(name.getEnd() - (isTsPlugin ? sourceScript.snapshot.getLength() : 0))) {
|
|
21
21
|
if (source[0] >= sfc.template.startTagEnd + templateCodeRange[0]
|
|
22
22
|
&& source[0] <= sfc.template.startTagEnd + templateCodeRange[1]
|
|
23
23
|
&& (0, language_core_1.isSemanticTokensEnabled)(source[1].data)) {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { type Language, type SourceScript, type VueVirtualCode } from '@vue/language-core';
|
|
2
2
|
import type * as ts from 'typescript';
|
|
3
|
-
export declare function getPropertiesAtLocation(ts: typeof import('typescript'), language: Language, program: ts.Program, sourceScript: SourceScript, virtualCode: VueVirtualCode, position: number): string[];
|
|
3
|
+
export declare function getPropertiesAtLocation(ts: typeof import('typescript'), language: Language, program: ts.Program, sourceScript: SourceScript, virtualCode: VueVirtualCode, position: number, isTsPlugin: boolean): string[];
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.getPropertiesAtLocation = getPropertiesAtLocation;
|
|
5
5
|
const language_core_1 = require("@vue/language-core");
|
|
6
|
-
function getPropertiesAtLocation(ts, language, program, sourceScript, virtualCode, position) {
|
|
6
|
+
function getPropertiesAtLocation(ts, language, program, sourceScript, virtualCode, position, isTsPlugin) {
|
|
7
7
|
const virtualScript = sourceScript.generated.languagePlugin.typescript?.getServiceScript(virtualCode);
|
|
8
8
|
if (!virtualScript) {
|
|
9
9
|
return [];
|
|
@@ -24,7 +24,7 @@ function getPropertiesAtLocation(ts, language, program, sourceScript, virtualCod
|
|
|
24
24
|
if (!mapped) {
|
|
25
25
|
return [];
|
|
26
26
|
}
|
|
27
|
-
position += sourceScript.snapshot.getLength();
|
|
27
|
+
position += isTsPlugin ? sourceScript.snapshot.getLength() : 0;
|
|
28
28
|
const sourceFile = program.getSourceFile(virtualCode.fileName);
|
|
29
29
|
if (!sourceFile) {
|
|
30
30
|
return [];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/typescript-plugin",
|
|
3
|
-
"version": "3.0.7-alpha.
|
|
3
|
+
"version": "3.0.7-alpha.1",
|
|
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.23",
|
|
17
|
-
"@vue/language-core": "3.0.7-alpha.
|
|
17
|
+
"@vue/language-core": "3.0.7-alpha.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": "320fc626c871e9ff17c0e4e92ea7ddb0c7641f34"
|
|
26
26
|
}
|