@guihz/trading-vue-editor-tes 0.0.63 → 0.0.64

Sign up to get free protection for your applications and to get access to all the features.
@@ -53,6 +53,9 @@ export declare const ERRORS_TIPS: {
53
53
  strategyRunErr: string;
54
54
  exportUseErr: string;
55
55
  funcRepeatErr: string;
56
+ importMultipleErr: string;
57
+ importNotExitErr: string;
58
+ importNameRepeatErr: string;
56
59
  };
57
60
  export declare const WARNING_TIPS: {
58
61
  repeatVar: string;
@@ -86,3 +89,162 @@ export declare const READY_ONLY_OPTIONS: {
86
89
  contextmenu: boolean;
87
90
  };
88
91
  export declare const COMMENTS_DESC_REG: RegExp;
92
+ export declare const DEFAULT_EXPORT_TEST: {
93
+ functions: ({
94
+ name: string;
95
+ desc: string[];
96
+ args: ({
97
+ name: string;
98
+ desc: string;
99
+ required: boolean;
100
+ allowedTypeIDs: string[];
101
+ displayType: string;
102
+ } | {
103
+ name: string;
104
+ required: boolean;
105
+ allowedTypeIDs: string[];
106
+ displayType: string;
107
+ desc?: undefined;
108
+ })[];
109
+ syntax: string[];
110
+ hasMemberIndex: boolean;
111
+ pos: {
112
+ lineNumber: number;
113
+ column: number;
114
+ };
115
+ isUser: boolean;
116
+ returnedTypes: string[];
117
+ returns: string[];
118
+ index?: undefined;
119
+ info?: undefined;
120
+ } | {
121
+ name: string;
122
+ args: {
123
+ name: string;
124
+ required: boolean;
125
+ allowedTypeIDs: string[];
126
+ displayType: string;
127
+ }[];
128
+ syntax: string[];
129
+ hasMemberIndex: boolean;
130
+ pos: {
131
+ lineNumber: number;
132
+ column: number;
133
+ };
134
+ isUser: boolean;
135
+ returnedTypes: string[];
136
+ index: number;
137
+ desc?: undefined;
138
+ returns?: undefined;
139
+ info?: undefined;
140
+ } | {
141
+ name: string;
142
+ args: {
143
+ name: string;
144
+ required: boolean;
145
+ allowedTypeIDs: string[];
146
+ displayType: string;
147
+ }[];
148
+ returnedTypes: string[];
149
+ pos: {
150
+ lineNumber: number;
151
+ column: number;
152
+ };
153
+ syntax: string[];
154
+ desc?: undefined;
155
+ hasMemberIndex?: undefined;
156
+ isUser?: undefined;
157
+ returns?: undefined;
158
+ index?: undefined;
159
+ info?: undefined;
160
+ } | {
161
+ name: string;
162
+ args: {
163
+ name: string;
164
+ required: boolean;
165
+ allowedTypeIDs: string[];
166
+ displayType: string;
167
+ }[];
168
+ returnedTypes: string[];
169
+ pos: {
170
+ lineNumber: number;
171
+ column: number;
172
+ };
173
+ info: string;
174
+ syntax: string[];
175
+ desc?: undefined;
176
+ hasMemberIndex?: undefined;
177
+ isUser?: undefined;
178
+ returns?: undefined;
179
+ index?: undefined;
180
+ })[];
181
+ methods: ({
182
+ name: string;
183
+ args: {
184
+ name: string;
185
+ required: boolean;
186
+ allowedTypeIDs: string[];
187
+ displayType: string;
188
+ }[];
189
+ desc: string[];
190
+ originalName: string;
191
+ syntax: string[];
192
+ returnedTypes: string[];
193
+ hasMemberIndex: boolean;
194
+ pos: {
195
+ lineNumber: number;
196
+ column: number;
197
+ };
198
+ thisType: string[];
199
+ returns: string[];
200
+ index?: undefined;
201
+ } | {
202
+ name: string;
203
+ args: {
204
+ name: string;
205
+ required: boolean;
206
+ allowedTypeIDs: string[];
207
+ displayType: string;
208
+ }[];
209
+ originalName: string;
210
+ syntax: string[];
211
+ returnedTypes: string[];
212
+ hasMemberIndex: boolean;
213
+ pos: {
214
+ lineNumber: number;
215
+ column: number;
216
+ };
217
+ thisType: string[];
218
+ index: number;
219
+ desc?: undefined;
220
+ returns?: undefined;
221
+ } | {
222
+ name: string;
223
+ args: never[];
224
+ returnedTypes: string[];
225
+ thisType: string[];
226
+ pos: {
227
+ lineNumber: number;
228
+ column: number;
229
+ };
230
+ syntax: string[];
231
+ desc?: undefined;
232
+ originalName?: undefined;
233
+ hasMemberIndex?: undefined;
234
+ returns?: undefined;
235
+ index?: undefined;
236
+ })[];
237
+ types: {
238
+ fields: {
239
+ name: string;
240
+ type: string;
241
+ }[];
242
+ name: string;
243
+ pos: {
244
+ lineNumber: number;
245
+ column: number;
246
+ };
247
+ }[];
248
+ description: string;
249
+ codeStr: string;
250
+ };
@@ -28,7 +28,11 @@ export default class ParserVisitor extends ParserUtils {
28
28
  private _exportMethods;
29
29
  private _exportTypes;
30
30
  private _exportPositions;
31
- constructor(props: IKeyObjectValue, comments: IKeyObjectValue[]);
31
+ private _description;
32
+ private _endExport;
33
+ private _importLibs;
34
+ private _getImportLibraryFunc;
35
+ constructor(props: IKeyObjectValue, comments: IKeyObjectValue[], getImportLibraryFunc: (obj: IKeyObjectValue) => IKeyObjectValue);
32
36
  get overloadsFuncs(): IKeyValue[];
33
37
  get errors(): IError[];
34
38
  get userTypes(): Map<string, IDocValue[]>;
@@ -43,11 +47,14 @@ export default class ParserVisitor extends ParserUtils {
43
47
  methods: IDocValue[];
44
48
  types: IDocValue[];
45
49
  };
50
+ get description(): string;
46
51
  get exportPositions(): (IRange & {
47
52
  type: string;
48
53
  })[];
49
- visitProgram: (ctx: IKeyObjectValue) => any[];
50
- visitGlobalStmt: (ctx: IKeyObjectValue) => any;
54
+ get endExport(): IKeyObjectValue;
55
+ get imports(): Map<string, IKeyObjectValue>;
56
+ visitProgram: (ctx: IKeyObjectValue) => Promise<any[]>;
57
+ visitGlobalStmt: (ctx: IKeyObjectValue) => Promise<any>;
51
58
  visitBlockStmt: (ctx: IKeyObjectValue) => IKeyObjectValue[];
52
59
  visitStmt: (ctx: IKeyObjectValue) => any;
53
60
  visitSimpleStmt: (ctx: IKeyObjectValue) => any;
@@ -189,8 +196,12 @@ export default class ParserVisitor extends ParserUtils {
189
196
  visitCaseClause: (ctx: IKeyObjectValue) => IKeyObjectValue;
190
197
  visitDefaultCaluse: (ctx: IKeyObjectValue) => IKeyObjectValue;
191
198
  visitWhileStatement: (ctx: IKeyObjectValue) => IKeyObjectValue;
192
- visitImportStmt: (ctx: IKeyObjectValue) => IKeyObjectValue[];
193
- visitImportElement: (ctx: IKeyObjectValue) => IKeyObjectValue | undefined;
199
+ visitImportStmt: (ctx: IKeyObjectValue) => Promise<IKeyObjectValue[]>;
200
+ visitImportElement: (ctx: IKeyObjectValue) => Promise<IKeyObjectValue | undefined>;
201
+ private _importHandle;
202
+ private _importDataHandle;
203
+ private _importTypeUpdate;
204
+ private _replaceTypeName;
194
205
  visitLiteral: (ctx: IKeyObjectValue) => {
195
206
  ruleType: VRuleType;
196
207
  ctx: IKeyObjectValue;
@@ -1,4 +1,4 @@
1
- import { IDocValue } from '../type';
1
+ import { IDocValue, IKeyObjectValue } from '../type';
2
2
  import { Token } from './config';
3
3
  import { IKeys } from '../constants/contents';
4
4
  export declare function mergeToRegExpStr(keys: string[]): string;
@@ -29,5 +29,6 @@ export declare class FormatMarkdown {
29
29
  link(value: string, url: URL): string;
30
30
  }
31
31
  export declare const formatMarkdown: FormatMarkdown;
32
+ export declare function markdownHoverImportBuilder(item: IKeyObjectValue): string;
32
33
  export declare function markdownHoverBuilder(items: IDocValue[], currentIndex?: number, isSupport?: boolean): string;
33
34
  export {};
@@ -51,6 +51,7 @@ export interface IDocValue {
51
51
  valueType?: string;
52
52
  defaultValue?: any;
53
53
  index?: number;
54
+ isImport?: boolean;
54
55
  }
55
56
  export interface IDetailedDesc {
56
57
  desc: string[];
@@ -72,3 +73,10 @@ export interface IArg {
72
73
  allowedTypeIDs?: string[];
73
74
  displayType?: string;
74
75
  }
76
+ export interface IImportLibrary {
77
+ codeStr: string;
78
+ description: string;
79
+ functions: IDocValue[];
80
+ types: IDocValue[];
81
+ methods: IDocValue[];
82
+ }
@@ -17,7 +17,6 @@ export declare class MyCompletion {
17
17
  private _methodFuncs;
18
18
  private _userTypes;
19
19
  private _nextIsBracket;
20
- private _annotationSuggestions;
21
20
  constructor();
22
21
  get methodFuncs(): Map<string, IDocValue[]>;
23
22
  get userFuncs(): Map<string, IDocValue[]>;
@@ -0,0 +1,179 @@
1
+ import { editor, languages } from "monaco-editor";
2
+ import { IImportLibrary, IKeyObjectValue } from "../type";
3
+ declare class ImportLibrary {
4
+ private _inlayHints;
5
+ private _editor?;
6
+ private _importCompleteLibrary;
7
+ private _funcs;
8
+ constructor();
9
+ get inlayHints(): languages.InlayHint[];
10
+ setEditor(editor: editor.IStandaloneCodeEditor): void;
11
+ setInlayHints(params: IKeyObjectValue): Promise<IImportLibrary | {
12
+ functions: ({
13
+ name: string;
14
+ desc: string[];
15
+ args: ({
16
+ name: string;
17
+ desc: string;
18
+ required: boolean;
19
+ allowedTypeIDs: string[];
20
+ displayType: string;
21
+ } | {
22
+ name: string;
23
+ required: boolean;
24
+ allowedTypeIDs: string[];
25
+ displayType: string;
26
+ desc?: undefined;
27
+ })[];
28
+ syntax: string[];
29
+ hasMemberIndex: boolean;
30
+ pos: {
31
+ lineNumber: number;
32
+ column: number;
33
+ };
34
+ isUser: boolean;
35
+ returnedTypes: string[];
36
+ returns: string[];
37
+ index?: undefined;
38
+ info?: undefined;
39
+ } | {
40
+ name: string;
41
+ args: {
42
+ name: string;
43
+ required: boolean;
44
+ allowedTypeIDs: string[];
45
+ displayType: string;
46
+ }[];
47
+ syntax: string[];
48
+ hasMemberIndex: boolean;
49
+ pos: {
50
+ lineNumber: number;
51
+ column: number;
52
+ };
53
+ isUser: boolean;
54
+ returnedTypes: string[];
55
+ index: number;
56
+ desc?: undefined;
57
+ returns?: undefined;
58
+ info?: undefined;
59
+ } | {
60
+ name: string;
61
+ args: {
62
+ name: string;
63
+ required: boolean;
64
+ allowedTypeIDs: string[];
65
+ displayType: string;
66
+ }[];
67
+ returnedTypes: string[];
68
+ pos: {
69
+ lineNumber: number;
70
+ column: number;
71
+ };
72
+ syntax: string[];
73
+ desc?: undefined;
74
+ hasMemberIndex?: undefined;
75
+ isUser?: undefined;
76
+ returns?: undefined;
77
+ index?: undefined;
78
+ info?: undefined;
79
+ } | {
80
+ name: string;
81
+ args: {
82
+ name: string;
83
+ required: boolean;
84
+ allowedTypeIDs: string[];
85
+ displayType: string;
86
+ }[];
87
+ returnedTypes: string[];
88
+ pos: {
89
+ lineNumber: number;
90
+ column: number;
91
+ };
92
+ info: string;
93
+ syntax: string[];
94
+ desc?: undefined;
95
+ hasMemberIndex?: undefined;
96
+ isUser?: undefined;
97
+ returns?: undefined;
98
+ index?: undefined;
99
+ })[];
100
+ methods: ({
101
+ name: string;
102
+ args: {
103
+ name: string;
104
+ required: boolean;
105
+ allowedTypeIDs: string[];
106
+ displayType: string;
107
+ }[];
108
+ desc: string[];
109
+ originalName: string;
110
+ syntax: string[];
111
+ returnedTypes: string[];
112
+ hasMemberIndex: boolean;
113
+ pos: {
114
+ lineNumber: number;
115
+ column: number;
116
+ };
117
+ thisType: string[];
118
+ returns: string[];
119
+ index?: undefined;
120
+ } | {
121
+ name: string;
122
+ args: {
123
+ name: string;
124
+ required: boolean;
125
+ allowedTypeIDs: string[];
126
+ displayType: string;
127
+ }[];
128
+ originalName: string;
129
+ syntax: string[];
130
+ returnedTypes: string[];
131
+ hasMemberIndex: boolean;
132
+ pos: {
133
+ lineNumber: number;
134
+ column: number;
135
+ };
136
+ thisType: string[];
137
+ index: number;
138
+ desc?: undefined;
139
+ returns?: undefined;
140
+ } | {
141
+ name: string;
142
+ args: never[];
143
+ returnedTypes: string[];
144
+ thisType: string[];
145
+ pos: {
146
+ lineNumber: number;
147
+ column: number;
148
+ };
149
+ syntax: string[];
150
+ desc?: undefined;
151
+ originalName?: undefined;
152
+ hasMemberIndex?: undefined;
153
+ returns?: undefined;
154
+ index?: undefined;
155
+ })[];
156
+ types: {
157
+ fields: {
158
+ name: string;
159
+ type: string;
160
+ }[];
161
+ name: string;
162
+ pos: {
163
+ lineNumber: number;
164
+ column: number;
165
+ };
166
+ }[];
167
+ description: string;
168
+ codeStr: string;
169
+ } | undefined>;
170
+ deleteInlayHints(name: string): void;
171
+ clearInlayHints(): void;
172
+ triggerInlayHints(): void;
173
+ private _updateFuncNames;
174
+ private _setNoNameInlayHints;
175
+ private _inlayHintsHandle;
176
+ private _updateMonarchTokens;
177
+ }
178
+ declare const _default: ImportLibrary;
179
+ export default _default;
@@ -5,16 +5,19 @@ interface IUserDefined {
5
5
  variables?: Map<string, IDocValue[]>;
6
6
  types?: Map<string, IDocValue[]>;
7
7
  methods?: Map<string, IDocValue[]>;
8
+ imports?: Map<string, IKeyObjectValue>;
8
9
  }
9
10
  export declare class Parse {
10
11
  private _userFunctions;
11
12
  private _userVariables;
12
13
  private _userTypes;
13
14
  private _userMethods;
15
+ private _imports;
14
16
  private _overloadsFuncs;
15
17
  constructor();
16
18
  setUserDefined(maps: IUserDefined, overloadsFuncs: IKeyValue[]): void;
17
19
  parseLineContentFuncVar(column: number, line: number, model: editor.ITextModel | null, position?: Position): IKeyObjectValue | null | undefined;
20
+ private _getImportDocVal;
18
21
  private _getBuildInFunc;
19
22
  private _getBuildInMethod;
20
23
  private _getBuildInOther;
@@ -14,9 +14,19 @@ export declare function parseTcc(val: string, hasTranscoding?: boolean): Promise
14
14
  [k: string]: import("../type").IDocValue[];
15
15
  };
16
16
  overloadsFuncs: import("../type").IKeyValue[];
17
+ imports: {
18
+ [k: string]: IKeyObjectValue;
19
+ };
17
20
  codeStr: string;
18
21
  preParserCode: string | undefined;
19
22
  }>;
23
+ export declare function parseLibrary(val: string, title: string): Promise<{
24
+ description: string;
25
+ codeStr: string;
26
+ functions: import("../type").IDocValue[];
27
+ methods: import("../type").IDocValue[];
28
+ types: import("../type").IDocValue[];
29
+ }>;
20
30
  export declare function scriptsRun(strJs: string, data: IKeyObjectValue, isNew?: boolean): Promise<{
21
31
  status: number;
22
32
  errors: any;
@@ -1,7 +1,7 @@
1
1
  /// <reference path="../../../../src/vite-env.d.ts" />
2
2
  import { ErrorListener } from "antlr4";
3
3
  import { IKeyObjectValue } from "../type";
4
- export default function parseTcc(program: string, hasTranscoding: boolean, keyObjs: IKeyObjectValue): Promise<{
4
+ export declare function parseTcc(program: string, hasTranscoding: boolean, getImportLibraryFunc: (obj: IKeyObjectValue) => IKeyObjectValue, keyObjs: IKeyObjectValue): Promise<{
5
5
  errors: any[];
6
6
  functions: {
7
7
  [k: string]: import("../type").IDocValue[];
@@ -16,10 +16,24 @@ export default function parseTcc(program: string, hasTranscoding: boolean, keyOb
16
16
  [k: string]: import("../type").IDocValue[];
17
17
  };
18
18
  overloadsFuncs: import("../type").IKeyValue[];
19
+ imports: {
20
+ [k: string]: IKeyObjectValue;
21
+ };
19
22
  codeStr: string;
20
23
  preParserCode: string | undefined;
21
24
  }>;
25
+ export declare function parseLibraryCode(program: string, libTitle: string, getImportLibraryFunc: (obj: IKeyObjectValue) => IKeyObjectValue, keyObjs: IKeyObjectValue): Promise<{
26
+ description: string;
27
+ codeStr: string;
28
+ functions: import("../type").IDocValue[];
29
+ methods: import("../type").IDocValue[];
30
+ types: import("../type").IDocValue[];
31
+ }>;
22
32
  export declare class ExprErrorListener extends ErrorListener {
23
33
  errors: any[];
24
34
  syntaxError(_: any, __: any, line: number, column: number, msg: string): void;
25
35
  }
36
+ export interface IParseWorker {
37
+ parseTcc: typeof parseTcc;
38
+ parseLibraryCode: typeof parseLibraryCode;
39
+ }
@@ -17,3 +17,7 @@ export declare function provideDefinition(model: editor.ITextModel, position: Po
17
17
  endColumn: number;
18
18
  };
19
19
  } | null;
20
+ export declare function provideInlayHints(): {
21
+ hints: languages.InlayHint[];
22
+ dispose: () => void;
23
+ };
@@ -2,7 +2,7 @@ export { Actions } from '../components/editor/tokenizer/config';
2
2
  export { default as TradingVueEditor } from '../components/editor/index';
3
3
  export { default as TradingVueDiffEditor } from '../components/diffEditor/index';
4
4
  export type { IRefs as IEditorRefs } from '../components/editor/index';
5
- export { parseTcc, scriptsRun, removeScript } from '../components/editor/utils/parserTcc';
5
+ export { parseTcc, scriptsRun, removeScript, parseLibrary } from '../components/editor/utils/parserTcc';
6
6
  export type { IError, IPosition } from '../components/editor/parseScript/type';
7
7
  export { VMarkerSeverity } from '../components/editor/parseScript/type';
8
8
  export { default as ReferenceManual } from '../components/referenceManual';