@vue/typescript-plugin 3.0.0-alpha.2 → 3.0.0-alpha.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/lib/client.d.ts +6 -6
- package/lib/common.js +9 -0
- package/lib/requests/getComponentProps.js +30 -23
- package/lib/requests/getSlotNames.d.ts +2 -2
- package/lib/server.d.ts +12 -12
- package/lib/utils.d.ts +18 -18
- package/package.json +7 -5
package/lib/client.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
export declare const collectExtractProps: (fileName: string, templateCodeRange: [number, number]) => Promise<{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
name: string;
|
|
3
|
+
type: string;
|
|
4
|
+
model: boolean;
|
|
5
5
|
}[] | null | undefined>;
|
|
6
|
-
export declare const getImportPathForFile: (fileName: string, incomingFileName: string, preferences: import(
|
|
6
|
+
export declare const getImportPathForFile: (fileName: string, incomingFileName: string, preferences: import('typescript').UserPreferences) => Promise<string | null | undefined>;
|
|
7
7
|
export declare const getPropertiesAtLocation: (fileName: string, position: number) => Promise<string[] | null | undefined>;
|
|
8
8
|
export declare const getQuickInfoAtPosition: (fileName: string, position: number) => Promise<string | null | undefined>;
|
|
9
|
-
export declare function getComponentProps(fileName: string, componentName: string): Promise<import(
|
|
9
|
+
export declare function getComponentProps(fileName: string, componentName: string): Promise<import('./requests/getComponentProps').ComponentPropInfo[] | null | undefined>;
|
|
10
10
|
export declare const getComponentEvents: (fileName: string, tag: string) => Promise<string[] | null | undefined>;
|
|
11
11
|
export declare const getComponentDirectives: (fileName: string) => Promise<string[] | null | undefined>;
|
|
12
12
|
export declare function getComponentNames(fileName: string): Promise<string[] | undefined>;
|
|
13
13
|
export declare const getElementAttrs: (fileName: string, tagName: string) => Promise<{
|
|
14
|
-
|
|
14
|
+
name: string;
|
|
15
15
|
}[] | null | undefined>;
|
|
16
16
|
export declare const getSlotNames: (fileName: string) => Promise<string[] | null | undefined>;
|
package/lib/common.js
CHANGED
|
@@ -151,6 +151,15 @@ function getDefinitionAndBoundSpan(ts, language, languageService, vueOptions, as
|
|
|
151
151
|
}
|
|
152
152
|
const definitions = new Set(result.definitions);
|
|
153
153
|
const skippedDefinitions = [];
|
|
154
|
+
// #5275
|
|
155
|
+
if (result.definitions.length >= 2) {
|
|
156
|
+
for (const definition of result.definitions) {
|
|
157
|
+
if (root.sfc.content[definition.textSpan.start - 1] === '@'
|
|
158
|
+
|| root.sfc.content.slice(definition.textSpan.start - 5, definition.textSpan.start) === 'v-on:') {
|
|
159
|
+
skippedDefinitions.push(definition);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
154
163
|
for (const definition of result.definitions) {
|
|
155
164
|
if (vueOptions.extensions.some(ext => definition.fileName.endsWith(ext))) {
|
|
156
165
|
continue;
|
|
@@ -10,8 +10,6 @@ function getComponentProps(fileName, tag) {
|
|
|
10
10
|
return;
|
|
11
11
|
}
|
|
12
12
|
const vueCode = volarFile.generated.root;
|
|
13
|
-
const program = languageService.getProgram();
|
|
14
|
-
const checker = program.getTypeChecker();
|
|
15
13
|
const components = (0, utils_1.getVariableType)(ts, languageService, vueCode, '__VLS_components');
|
|
16
14
|
if (!components) {
|
|
17
15
|
return [];
|
|
@@ -21,21 +19,15 @@ function getComponentProps(fileName, tag) {
|
|
|
21
19
|
return [];
|
|
22
20
|
}
|
|
23
21
|
const result = new Map();
|
|
22
|
+
const program = languageService.getProgram();
|
|
23
|
+
const checker = program.getTypeChecker();
|
|
24
24
|
for (const sig of componentType.getCallSignatures()) {
|
|
25
25
|
const propParam = sig.parameters[0];
|
|
26
26
|
if (propParam) {
|
|
27
27
|
const propsType = checker.getTypeOfSymbolAtLocation(propParam, components.node);
|
|
28
28
|
const props = propsType.getProperties();
|
|
29
29
|
for (const prop of props) {
|
|
30
|
-
|
|
31
|
-
const required = !(prop.flags & ts.SymbolFlags.Optional) || undefined;
|
|
32
|
-
const { content: commentMarkdown, deprecated } = generateCommentMarkdown(prop.getDocumentationComment(checker), prop.getJsDocTags());
|
|
33
|
-
result.set(name, {
|
|
34
|
-
name,
|
|
35
|
-
required,
|
|
36
|
-
deprecated,
|
|
37
|
-
commentMarkdown
|
|
38
|
-
});
|
|
30
|
+
handlePropSymbol(prop);
|
|
39
31
|
}
|
|
40
32
|
}
|
|
41
33
|
}
|
|
@@ -46,22 +38,37 @@ function getComponentProps(fileName, tag) {
|
|
|
46
38
|
const propsType = checker.getTypeOfSymbolAtLocation(propsSymbol, components.node);
|
|
47
39
|
const props = propsType.getProperties();
|
|
48
40
|
for (const prop of props) {
|
|
49
|
-
|
|
50
|
-
continue;
|
|
51
|
-
}
|
|
52
|
-
const name = prop.name;
|
|
53
|
-
const required = !(prop.flags & ts.SymbolFlags.Optional) || undefined;
|
|
54
|
-
const { content: commentMarkdown, deprecated } = generateCommentMarkdown(prop.getDocumentationComment(checker), prop.getJsDocTags());
|
|
55
|
-
result.set(name, {
|
|
56
|
-
name,
|
|
57
|
-
required,
|
|
58
|
-
deprecated,
|
|
59
|
-
commentMarkdown
|
|
60
|
-
});
|
|
41
|
+
handlePropSymbol(prop);
|
|
61
42
|
}
|
|
62
43
|
}
|
|
63
44
|
}
|
|
64
45
|
return [...result.values()];
|
|
46
|
+
function handlePropSymbol(prop) {
|
|
47
|
+
if (prop.flags & ts.SymbolFlags.Method) { // #2443
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
const name = prop.name;
|
|
51
|
+
const required = !(prop.flags & ts.SymbolFlags.Optional) || undefined;
|
|
52
|
+
const { content: commentMarkdown, deprecated, } = generateCommentMarkdown(prop.getDocumentationComment(checker), prop.getJsDocTags());
|
|
53
|
+
const values = [];
|
|
54
|
+
const type = checker.getTypeOfSymbol(prop);
|
|
55
|
+
const subTypes = type.types;
|
|
56
|
+
if (subTypes) {
|
|
57
|
+
for (const subType of subTypes) {
|
|
58
|
+
const value = subType.value;
|
|
59
|
+
if (value) {
|
|
60
|
+
values.push(value);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
result.set(name, {
|
|
65
|
+
name,
|
|
66
|
+
required,
|
|
67
|
+
deprecated,
|
|
68
|
+
commentMarkdown,
|
|
69
|
+
values,
|
|
70
|
+
});
|
|
71
|
+
}
|
|
65
72
|
}
|
|
66
73
|
function generateCommentMarkdown(parts, jsDocTags) {
|
|
67
74
|
const parsedComment = _symbolDisplayPartsToMarkdown(parts);
|
package/lib/server.d.ts
CHANGED
|
@@ -3,23 +3,23 @@ import type * as ts from 'typescript';
|
|
|
3
3
|
export type RequestType = 'containsFile' | 'projectInfo' | 'collectExtractProps' | 'getImportPathForFile' | 'getPropertiesAtLocation' | 'getQuickInfoAtPosition' | 'subscribeComponentProps' | 'getComponentEvents' | 'getComponentDirectives' | 'getElementAttrs' | 'getSlotNames';
|
|
4
4
|
export type NotificationType = 'componentNamesUpdated' | 'componentPropsUpdated';
|
|
5
5
|
export type RequestData = [
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
seq: number,
|
|
7
|
+
type: RequestType,
|
|
8
|
+
fileName: string,
|
|
9
|
+
...args: any[],
|
|
10
10
|
];
|
|
11
11
|
export type ResponseData = [
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
seq: number,
|
|
13
|
+
data: any,
|
|
14
14
|
];
|
|
15
15
|
export type NotificationData = [
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
type: NotificationType,
|
|
17
|
+
fileName: string,
|
|
18
|
+
data: any,
|
|
19
19
|
];
|
|
20
20
|
export interface ProjectInfo {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
name: string;
|
|
22
|
+
kind: ts.server.ProjectKind;
|
|
23
|
+
currentDirectory: string;
|
|
24
24
|
}
|
|
25
25
|
export declare function startNamedPipeServer(ts: typeof import('typescript'), info: ts.server.PluginCreateInfo, language: Language<string>, projectKind: ts.server.ProjectKind.Inferred | ts.server.ProjectKind.Configured): Promise<void>;
|
package/lib/utils.d.ts
CHANGED
|
@@ -6,24 +6,24 @@ import type { NotificationData, ProjectInfo, RequestData } from './server';
|
|
|
6
6
|
export { TypeScriptProjectHost } from '@volar/typescript';
|
|
7
7
|
export declare function getServerPath(kind: ts.server.ProjectKind, id: number): string;
|
|
8
8
|
declare class NamedPipeServer {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
9
|
+
path: string;
|
|
10
|
+
connecting: boolean;
|
|
11
|
+
projectInfo?: ProjectInfo;
|
|
12
|
+
containsFileCache: Map<string, Promise<boolean | null | undefined>>;
|
|
13
|
+
componentNamesAndProps: FileMap<Record<string, ComponentPropInfo[] | null>>;
|
|
14
|
+
constructor(kind: ts.server.ProjectKind, id: number);
|
|
15
|
+
containsFile(fileName: string): Promise<boolean | null | undefined> | undefined;
|
|
16
|
+
getComponentProps(fileName: string, tag: string): Promise<ComponentPropInfo[] | null | undefined>;
|
|
17
|
+
update(): void;
|
|
18
|
+
connect(): void;
|
|
19
|
+
close(): void;
|
|
20
|
+
socket?: net.Socket;
|
|
21
|
+
seq: number;
|
|
22
|
+
dataChunks: Buffer[];
|
|
23
|
+
requestHandlers: Map<number, (res: any) => void>;
|
|
24
|
+
onData(chunk: Buffer): void;
|
|
25
|
+
onNotification(type: NotificationData[0], fileName: string, data: any): void;
|
|
26
|
+
sendRequest<T>(requestType: RequestData[1], fileName: string, ...args: any[]): Promise<T | null | undefined>;
|
|
27
27
|
}
|
|
28
28
|
export declare const configuredServers: NamedPipeServer[];
|
|
29
29
|
export declare const inferredServers: NamedPipeServer[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/typescript-plugin",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"files": [
|
|
6
6
|
"**/*.js",
|
|
@@ -14,11 +14,13 @@
|
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@volar/typescript": "~2.4.11",
|
|
17
|
-
"@vue/language-core": "3.0.0-alpha.
|
|
18
|
-
"@vue/shared": "^3.5.0"
|
|
17
|
+
"@vue/language-core": "3.0.0-alpha.4",
|
|
18
|
+
"@vue/shared": "^3.5.0",
|
|
19
|
+
"path-browserify": "^1.0.1"
|
|
19
20
|
},
|
|
20
21
|
"devDependencies": {
|
|
21
|
-
"@types/node": "^22.10.4"
|
|
22
|
+
"@types/node": "^22.10.4",
|
|
23
|
+
"@types/path-browserify": "^1.0.1"
|
|
22
24
|
},
|
|
23
|
-
"gitHead": "
|
|
25
|
+
"gitHead": "1769cd6b94ec9e0cc2681b8dbba904f35856ba1c"
|
|
24
26
|
}
|