@finos/legend-application-pure-ide 6.2.21 → 6.2.23
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/components/editor/edit-panel/PureFileEditor.d.ts.map +1 -1
- package/lib/components/editor/edit-panel/PureFileEditor.js +65 -28
- package/lib/components/editor/edit-panel/PureFileEditor.js.map +1 -1
- package/lib/components/editor/side-bar/ConceptTreeExplorer.d.ts.map +1 -1
- package/lib/components/editor/side-bar/ConceptTreeExplorer.js +12 -6
- package/lib/components/editor/side-bar/ConceptTreeExplorer.js.map +1 -1
- package/lib/components/editor/side-bar/DirectoryTreeExplorer.d.ts.map +1 -1
- package/lib/components/editor/side-bar/DirectoryTreeExplorer.js +7 -2
- package/lib/components/editor/side-bar/DirectoryTreeExplorer.js.map +1 -1
- package/lib/extensions.css +1 -1
- package/lib/index.css +1 -1
- package/lib/package.json +1 -1
- package/lib/server/PureServerClient.d.ts +8 -3
- package/lib/server/PureServerClient.d.ts.map +1 -1
- package/lib/server/PureServerClient.js +38 -17
- package/lib/server/PureServerClient.js.map +1 -1
- package/lib/server/models/ConceptTree.d.ts +2 -0
- package/lib/server/models/ConceptTree.d.ts.map +1 -1
- package/lib/server/models/ConceptTree.js +2 -0
- package/lib/server/models/ConceptTree.js.map +1 -1
- package/lib/{stores/FileEditorUtils.d.ts → server/models/Suggestion.d.ts} +19 -7
- package/lib/server/models/Suggestion.d.ts.map +1 -0
- package/lib/server/models/Suggestion.js +53 -0
- package/lib/server/models/Suggestion.js.map +1 -0
- package/lib/stores/FileEditorState.d.ts.map +1 -1
- package/lib/stores/FileEditorState.js +3 -2
- package/lib/stores/FileEditorState.js.map +1 -1
- package/lib/stores/PureFileEditorUtils.d.ts +29 -0
- package/lib/stores/PureFileEditorUtils.d.ts.map +1 -0
- package/lib/stores/PureFileEditorUtils.js +433 -0
- package/lib/stores/PureFileEditorUtils.js.map +1 -0
- package/package.json +4 -4
- package/src/components/editor/edit-panel/PureFileEditor.tsx +131 -52
- package/src/components/editor/side-bar/ConceptTreeExplorer.tsx +21 -10
- package/src/components/editor/side-bar/DirectoryTreeExplorer.tsx +8 -0
- package/src/server/PureServerClient.ts +81 -30
- package/src/server/models/ConceptTree.ts +2 -0
- package/src/server/models/Suggestion.ts +59 -0
- package/src/stores/FileEditorState.ts +2 -2
- package/src/stores/PureFileEditorUtils.ts +613 -0
- package/tsconfig.json +2 -1
- package/lib/stores/FileEditorUtils.d.ts.map +0 -1
- package/lib/stores/FileEditorUtils.js +0 -188
- package/lib/stores/FileEditorUtils.js.map +0 -1
- package/src/stores/FileEditorUtils.ts +0 -219
|
@@ -51,8 +51,14 @@ import {
|
|
|
51
51
|
collectExtraInlineSnippetSuggestions,
|
|
52
52
|
collectParserElementSnippetSuggestions,
|
|
53
53
|
collectParserKeywordSuggestions,
|
|
54
|
+
getArrowFunctionSuggestions,
|
|
55
|
+
getAttributeSuggestions,
|
|
56
|
+
getCastingClassSuggestions,
|
|
57
|
+
getConstructorClassSuggestions,
|
|
54
58
|
getCopyrightHeaderSuggestions,
|
|
55
|
-
|
|
59
|
+
getIdentifierSuggestions,
|
|
60
|
+
getIncompletePathSuggestions,
|
|
61
|
+
} from '../../../stores/PureFileEditorUtils.js';
|
|
56
62
|
import { guaranteeNonNullable } from '@finos/legend-shared';
|
|
57
63
|
import { flowResult } from 'mobx';
|
|
58
64
|
import { FileCoordinate } from '../../../server/models/File.js';
|
|
@@ -142,12 +148,15 @@ const RenameConceptPrompt = observer(
|
|
|
142
148
|
export const PureFileEditor = observer(
|
|
143
149
|
(props: { editorState: FileEditorState }) => {
|
|
144
150
|
const { editorState } = props;
|
|
145
|
-
const suggestionProviderDisposer = useRef<IDisposable | undefined>(
|
|
146
|
-
undefined,
|
|
147
|
-
);
|
|
148
151
|
const definitionProviderDisposer = useRef<IDisposable | undefined>(
|
|
149
152
|
undefined,
|
|
150
153
|
);
|
|
154
|
+
const pureConstructSuggestionProviderDisposer = useRef<
|
|
155
|
+
IDisposable | undefined
|
|
156
|
+
>(undefined);
|
|
157
|
+
const pureIdentifierSuggestionProviderDisposer = useRef<
|
|
158
|
+
IDisposable | undefined
|
|
159
|
+
>(undefined);
|
|
151
160
|
const textInputRef = useRef<HTMLDivElement>(null);
|
|
152
161
|
const [editor, setEditor] = useState<
|
|
153
162
|
monacoEditorAPI.IStandaloneCodeEditor | undefined
|
|
@@ -155,7 +164,6 @@ export const PureFileEditor = observer(
|
|
|
155
164
|
const [isContextMenuOpen, setIsContextMenuOpen] = useState(false);
|
|
156
165
|
const editorStore = useEditorStore();
|
|
157
166
|
const applicationStore = useApplicationStore();
|
|
158
|
-
const content = editorState.file.content;
|
|
159
167
|
const { ref, width, height } = useResizeDetector<HTMLDivElement>();
|
|
160
168
|
|
|
161
169
|
useEffect(() => {
|
|
@@ -294,6 +302,7 @@ export const PureFileEditor = observer(
|
|
|
294
302
|
newEditor.onDidChangeCursorSelection(() => {
|
|
295
303
|
editorState.textEditorState.notifyCursorObserver();
|
|
296
304
|
});
|
|
305
|
+
|
|
297
306
|
// Restore the editor model and view state
|
|
298
307
|
newEditor.setModel(editorState.textEditorState.model);
|
|
299
308
|
if (editorState.textEditorState.viewState) {
|
|
@@ -305,14 +314,6 @@ export const PureFileEditor = observer(
|
|
|
305
314
|
}
|
|
306
315
|
}, [editorStore, applicationStore, editorState, editor]);
|
|
307
316
|
|
|
308
|
-
if (editor) {
|
|
309
|
-
// Set the value of the editor
|
|
310
|
-
const currentValue = editor.getValue();
|
|
311
|
-
if (currentValue !== content) {
|
|
312
|
-
editor.setValue(content);
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
|
|
316
317
|
const textTokens = editor
|
|
317
318
|
? monacoEditorAPI.tokenize(editor.getValue(), EDITOR_LANGUAGE.PURE)
|
|
318
319
|
: [];
|
|
@@ -324,9 +325,10 @@ export const PureFileEditor = observer(
|
|
|
324
325
|
// where sometimes, hovering the mouse on the right half of the last character of a definition token
|
|
325
326
|
// and then hitting Ctrl/Cmd key will not be trigger definition provider. We're not quite sure what
|
|
326
327
|
// to do with that for the time being.
|
|
327
|
-
const lineTokens =
|
|
328
|
-
|
|
329
|
-
|
|
328
|
+
const lineTokens = textTokens[position.lineNumber - 1];
|
|
329
|
+
if (!lineTokens) {
|
|
330
|
+
return [];
|
|
331
|
+
}
|
|
330
332
|
let currentToken: Token | undefined = undefined;
|
|
331
333
|
let currentTokenRange: IRange | undefined = undefined;
|
|
332
334
|
for (let i = 1; i < lineTokens.length; ++i) {
|
|
@@ -369,47 +371,122 @@ export const PureFileEditor = observer(
|
|
|
369
371
|
},
|
|
370
372
|
});
|
|
371
373
|
|
|
372
|
-
//
|
|
373
|
-
|
|
374
|
-
|
|
374
|
+
// suggestions
|
|
375
|
+
pureConstructSuggestionProviderDisposer.current?.dispose();
|
|
376
|
+
pureConstructSuggestionProviderDisposer.current =
|
|
377
|
+
monacoLanguagesAPI.registerCompletionItemProvider(EDITOR_LANGUAGE.PURE, {
|
|
378
|
+
triggerCharacters: ['#', ':', '>', '.', '@', '^'],
|
|
379
|
+
provideCompletionItems: async (model, position, context) => {
|
|
380
|
+
let suggestions: monacoLanguagesAPI.CompletionItem[] = [];
|
|
381
|
+
|
|
382
|
+
if (
|
|
383
|
+
context.triggerKind ===
|
|
384
|
+
monacoLanguagesAPI.CompletionTriggerKind.TriggerCharacter
|
|
385
|
+
) {
|
|
386
|
+
switch (context.triggerCharacter) {
|
|
387
|
+
case '#': {
|
|
388
|
+
suggestions = suggestions.concat(
|
|
389
|
+
getParserKeywordSuggestions(
|
|
390
|
+
position,
|
|
391
|
+
model,
|
|
392
|
+
collectParserKeywordSuggestions(),
|
|
393
|
+
),
|
|
394
|
+
);
|
|
395
|
+
break;
|
|
396
|
+
}
|
|
397
|
+
case ':': {
|
|
398
|
+
suggestions = suggestions.concat(
|
|
399
|
+
await getIncompletePathSuggestions(
|
|
400
|
+
position,
|
|
401
|
+
model,
|
|
402
|
+
editorStore,
|
|
403
|
+
),
|
|
404
|
+
);
|
|
405
|
+
break;
|
|
406
|
+
}
|
|
407
|
+
case '>': {
|
|
408
|
+
suggestions = suggestions.concat(
|
|
409
|
+
await getArrowFunctionSuggestions(
|
|
410
|
+
position,
|
|
411
|
+
model,
|
|
412
|
+
editorStore,
|
|
413
|
+
),
|
|
414
|
+
);
|
|
415
|
+
break;
|
|
416
|
+
}
|
|
417
|
+
case '.': {
|
|
418
|
+
suggestions = suggestions.concat(
|
|
419
|
+
await getAttributeSuggestions(position, model, editorStore),
|
|
420
|
+
);
|
|
421
|
+
break;
|
|
422
|
+
}
|
|
423
|
+
case '^': {
|
|
424
|
+
suggestions = suggestions.concat(
|
|
425
|
+
await getConstructorClassSuggestions(
|
|
426
|
+
position,
|
|
427
|
+
model,
|
|
428
|
+
editorStore,
|
|
429
|
+
),
|
|
430
|
+
);
|
|
431
|
+
break;
|
|
432
|
+
}
|
|
433
|
+
case '@': {
|
|
434
|
+
suggestions = suggestions.concat(
|
|
435
|
+
await getCastingClassSuggestions(
|
|
436
|
+
position,
|
|
437
|
+
model,
|
|
438
|
+
editorStore,
|
|
439
|
+
),
|
|
440
|
+
);
|
|
441
|
+
break;
|
|
442
|
+
}
|
|
443
|
+
default:
|
|
444
|
+
break;
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
return { suggestions };
|
|
449
|
+
},
|
|
450
|
+
});
|
|
451
|
+
|
|
452
|
+
pureIdentifierSuggestionProviderDisposer.current?.dispose();
|
|
453
|
+
pureIdentifierSuggestionProviderDisposer.current =
|
|
375
454
|
monacoLanguagesAPI.registerCompletionItemProvider(EDITOR_LANGUAGE.PURE, {
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
// See https://microsoft.github.io/monaco-editor/api/interfaces/monaco.languages.CompletionContext.html#triggerCharacter
|
|
379
|
-
// See https://github.com/microsoft/monaco-editor/issues/2530#issuecomment-861757198
|
|
380
|
-
triggerCharacters: ['#'],
|
|
381
|
-
provideCompletionItems: (model, position) => {
|
|
455
|
+
triggerCharacters: [],
|
|
456
|
+
provideCompletionItems: async (model, position, context) => {
|
|
382
457
|
let suggestions: monacoLanguagesAPI.CompletionItem[] = [];
|
|
383
458
|
|
|
384
|
-
|
|
459
|
+
if (
|
|
460
|
+
context.triggerKind ===
|
|
461
|
+
monacoLanguagesAPI.CompletionTriggerKind.Invoke
|
|
462
|
+
) {
|
|
463
|
+
// copyright header
|
|
464
|
+
suggestions = suggestions.concat(getCopyrightHeaderSuggestions());
|
|
385
465
|
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
466
|
+
// suggestions for parser element snippets
|
|
467
|
+
suggestions = suggestions.concat(
|
|
468
|
+
getParserElementSnippetSuggestions(
|
|
469
|
+
position,
|
|
470
|
+
model,
|
|
471
|
+
(parserName: string) =>
|
|
472
|
+
collectParserElementSnippetSuggestions(parserName),
|
|
473
|
+
),
|
|
474
|
+
);
|
|
394
475
|
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
)
|
|
403
|
-
);
|
|
476
|
+
// code snippet suggestions
|
|
477
|
+
suggestions = suggestions.concat(
|
|
478
|
+
getInlineSnippetSuggestions(
|
|
479
|
+
position,
|
|
480
|
+
model,
|
|
481
|
+
collectExtraInlineSnippetSuggestions(),
|
|
482
|
+
),
|
|
483
|
+
);
|
|
404
484
|
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
collectExtraInlineSnippetSuggestions(),
|
|
411
|
-
),
|
|
412
|
-
);
|
|
485
|
+
// identifier suggestions (fetched asynchronously)
|
|
486
|
+
suggestions = suggestions.concat(
|
|
487
|
+
await getIdentifierSuggestions(position, model, editorStore),
|
|
488
|
+
);
|
|
489
|
+
}
|
|
413
490
|
|
|
414
491
|
return { suggestions };
|
|
415
492
|
},
|
|
@@ -480,7 +557,9 @@ export const PureFileEditor = observer(
|
|
|
480
557
|
}
|
|
481
558
|
|
|
482
559
|
definitionProviderDisposer.current?.dispose();
|
|
483
|
-
|
|
560
|
+
|
|
561
|
+
pureConstructSuggestionProviderDisposer.current?.dispose();
|
|
562
|
+
pureIdentifierSuggestionProviderDisposer.current?.dispose();
|
|
484
563
|
},
|
|
485
564
|
[editorState, editor],
|
|
486
565
|
);
|
|
@@ -39,6 +39,7 @@ import {
|
|
|
39
39
|
CompressIcon,
|
|
40
40
|
MenuContent,
|
|
41
41
|
MenuContentItem,
|
|
42
|
+
MenuContentDivider,
|
|
42
43
|
} from '@finos/legend-art';
|
|
43
44
|
import { guaranteeType, isNonNullable } from '@finos/legend-shared';
|
|
44
45
|
import { useDrag } from 'react-dnd';
|
|
@@ -57,7 +58,8 @@ const ConceptExplorerContextMenu = observer(
|
|
|
57
58
|
}
|
|
58
59
|
>(function ConceptExplorerContextMenu(props, ref) {
|
|
59
60
|
const { node, viewConceptSource } = props;
|
|
60
|
-
const
|
|
61
|
+
const nodeAttribute = node.data.li_attr;
|
|
62
|
+
const nodeType = nodeAttribute.pureType;
|
|
61
63
|
const editorStore = useEditorStore();
|
|
62
64
|
const applicationStore = useApplicationStore();
|
|
63
65
|
const renameConcept = (): void =>
|
|
@@ -70,7 +72,6 @@ const ConceptExplorerContextMenu = observer(
|
|
|
70
72
|
);
|
|
71
73
|
};
|
|
72
74
|
const findUsages = (): void => {
|
|
73
|
-
const nodeAttribute = node.data.li_attr;
|
|
74
75
|
if (
|
|
75
76
|
nodeAttribute instanceof ElementConceptAttribute ||
|
|
76
77
|
nodeAttribute instanceof PropertyConceptAttribute
|
|
@@ -87,32 +88,42 @@ const ConceptExplorerContextMenu = observer(
|
|
|
87
88
|
const viewSource = (): void => viewConceptSource(node);
|
|
88
89
|
const serviceJSON = (): void => {
|
|
89
90
|
window.open(
|
|
90
|
-
`${editorStore.client.baseUrl}/execute?func=${
|
|
91
|
+
`${editorStore.client.baseUrl}/execute?func=${nodeAttribute.pureId}&mode=${editorStore.client.mode}`,
|
|
91
92
|
'_blank',
|
|
92
93
|
);
|
|
93
94
|
};
|
|
95
|
+
const copyPath = (): void => {
|
|
96
|
+
applicationStore
|
|
97
|
+
.copyTextToClipboard(nodeAttribute.pureId)
|
|
98
|
+
.catch(applicationStore.alertUnhandledError);
|
|
99
|
+
};
|
|
94
100
|
|
|
95
101
|
return (
|
|
96
102
|
<MenuContent ref={ref}>
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
103
|
+
{nodeAttribute.pureType !== ConceptType.PROPERTY &&
|
|
104
|
+
nodeAttribute.pureType !== ConceptType.QUALIFIED_PROPERTY && (
|
|
105
|
+
<MenuContentItem onClick={copyPath}>Copy Path</MenuContentItem>
|
|
106
|
+
)}
|
|
101
107
|
{nodeType === ConceptType.PACKAGE && (
|
|
102
|
-
<MenuContentItem onClick={runTests}>Run
|
|
108
|
+
<MenuContentItem onClick={runTests}>Run Tests</MenuContentItem>
|
|
103
109
|
)}
|
|
104
110
|
{nodeType === ConceptType.FUNCTION && (
|
|
105
111
|
<MenuContentItem onClick={serviceJSON}>
|
|
106
112
|
Service (JSON)
|
|
107
113
|
</MenuContentItem>
|
|
108
114
|
)}
|
|
109
|
-
{(
|
|
110
|
-
|
|
115
|
+
{(nodeAttribute instanceof PropertyConceptAttribute ||
|
|
116
|
+
nodeAttribute instanceof ElementConceptAttribute) && (
|
|
111
117
|
<MenuContentItem onClick={findUsages}>Find Usages</MenuContentItem>
|
|
112
118
|
)}
|
|
113
119
|
{nodeType !== ConceptType.PACKAGE && (
|
|
114
120
|
<MenuContentItem onClick={viewSource}>View Source</MenuContentItem>
|
|
115
121
|
)}
|
|
122
|
+
<MenuContentDivider />
|
|
123
|
+
<MenuContentItem onClick={renameConcept}>Rename</MenuContentItem>
|
|
124
|
+
{nodeAttribute instanceof ElementConceptAttribute && (
|
|
125
|
+
<MenuContentItem onClick={moveElement}>Move</MenuContentItem>
|
|
126
|
+
)}
|
|
116
127
|
</MenuContent>
|
|
117
128
|
);
|
|
118
129
|
}),
|
|
@@ -40,6 +40,7 @@ import {
|
|
|
40
40
|
WrenchIcon,
|
|
41
41
|
MenuContent,
|
|
42
42
|
MenuContentItem,
|
|
43
|
+
MenuContentDivider,
|
|
43
44
|
} from '@finos/legend-art';
|
|
44
45
|
import { isNonNullable } from '@finos/legend-shared';
|
|
45
46
|
import {
|
|
@@ -76,9 +77,16 @@ const FileExplorerContextMenu = observer(
|
|
|
76
77
|
};
|
|
77
78
|
const renameFile = (): void =>
|
|
78
79
|
editorStore.directoryTreeState.setNodeForRenameFile(node);
|
|
80
|
+
const copyPath = (): void => {
|
|
81
|
+
applicationStore
|
|
82
|
+
.copyTextToClipboard(node.data.li_attr.path)
|
|
83
|
+
.catch(applicationStore.alertUnhandledError);
|
|
84
|
+
};
|
|
79
85
|
|
|
80
86
|
return (
|
|
81
87
|
<MenuContent ref={ref}>
|
|
88
|
+
<MenuContentItem onClick={copyPath}>Copy Path</MenuContentItem>
|
|
89
|
+
<MenuContentDivider />
|
|
82
90
|
{isDir && (
|
|
83
91
|
<MenuContentItem onClick={createNewFile}>New File</MenuContentItem>
|
|
84
92
|
)}
|
|
@@ -59,6 +59,11 @@ import type {
|
|
|
59
59
|
ChildPackageableElementInfo,
|
|
60
60
|
MovePackageableElementsInput,
|
|
61
61
|
} from './models/MovePackageableElements.js';
|
|
62
|
+
import type {
|
|
63
|
+
AttributeSuggestion,
|
|
64
|
+
ClassSuggestion,
|
|
65
|
+
ElementSuggestion,
|
|
66
|
+
} from './models/Suggestion.js';
|
|
62
67
|
|
|
63
68
|
export class PureClient {
|
|
64
69
|
private networkClient: NetworkClient;
|
|
@@ -103,36 +108,6 @@ export class PureClient {
|
|
|
103
108
|
},
|
|
104
109
|
);
|
|
105
110
|
|
|
106
|
-
getFile = (path: string): Promise<PlainObject<File>> =>
|
|
107
|
-
this.networkClient.get(
|
|
108
|
-
`${this.baseUrl}/fileAsJson/${path}`,
|
|
109
|
-
undefined,
|
|
110
|
-
undefined,
|
|
111
|
-
{
|
|
112
|
-
sessionId: this.sessionId,
|
|
113
|
-
mode: this.mode,
|
|
114
|
-
fastCompile: this.compilerMode,
|
|
115
|
-
},
|
|
116
|
-
);
|
|
117
|
-
|
|
118
|
-
getDirectoryChildren = (
|
|
119
|
-
path?: string,
|
|
120
|
-
): Promise<PlainObject<DirectoryNode>[]> =>
|
|
121
|
-
this.networkClient.get(`${this.baseUrl}/dir`, undefined, undefined, {
|
|
122
|
-
parameters: path ?? '/',
|
|
123
|
-
mode: this.mode,
|
|
124
|
-
sessionId: this.sessionId,
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
getConceptChildren = (path?: string): Promise<PlainObject<ConceptNode>[]> =>
|
|
128
|
-
this.networkClient.get(`${this.baseUrl}/execute`, undefined, undefined, {
|
|
129
|
-
func: 'meta::pure::ide::display_ide(String[1]):String[1]',
|
|
130
|
-
param: path ? `'${path}'` : "'::'",
|
|
131
|
-
format: 'raw',
|
|
132
|
-
mode: this.mode,
|
|
133
|
-
sessionId: this.sessionId,
|
|
134
|
-
});
|
|
135
|
-
|
|
136
111
|
getConceptActivity = (): Promise<PlainObject<ConceptActivity>> =>
|
|
137
112
|
this.networkClient.get(
|
|
138
113
|
`${this.baseUrl}/conceptsActivity`,
|
|
@@ -173,6 +148,8 @@ export class PureClient {
|
|
|
173
148
|
},
|
|
174
149
|
);
|
|
175
150
|
|
|
151
|
+
// ------------------------------------------- Search -------------------------------------------
|
|
152
|
+
|
|
176
153
|
findFiles = (searchText: string, isRegExp: boolean): Promise<string[]> =>
|
|
177
154
|
this.networkClient.get(
|
|
178
155
|
`${this.baseUrl}/findPureFiles`,
|
|
@@ -210,6 +187,8 @@ export class PureClient {
|
|
|
210
187
|
coordinates,
|
|
211
188
|
);
|
|
212
189
|
|
|
190
|
+
// ------------------------------------------- Test -------------------------------------------
|
|
191
|
+
|
|
213
192
|
checkTestRunner = (
|
|
214
193
|
testRunnerId: number,
|
|
215
194
|
): Promise<PlainObject<AbstractTestRunnerCheckResult>> =>
|
|
@@ -234,6 +213,17 @@ export class PureClient {
|
|
|
234
213
|
},
|
|
235
214
|
);
|
|
236
215
|
|
|
216
|
+
// ------------------------------------------- Concept -------------------------------------------
|
|
217
|
+
|
|
218
|
+
getConceptChildren = (path?: string): Promise<PlainObject<ConceptNode>[]> =>
|
|
219
|
+
this.networkClient.get(`${this.baseUrl}/execute`, undefined, undefined, {
|
|
220
|
+
func: 'meta::pure::ide::display_ide(String[1]):String[1]',
|
|
221
|
+
param: path ? `'${path}'` : "'::'",
|
|
222
|
+
format: 'raw',
|
|
223
|
+
mode: this.mode,
|
|
224
|
+
sessionId: this.sessionId,
|
|
225
|
+
});
|
|
226
|
+
|
|
237
227
|
getConceptInfo = (
|
|
238
228
|
file: string,
|
|
239
229
|
line: number,
|
|
@@ -306,6 +296,29 @@ export class PureClient {
|
|
|
306
296
|
);
|
|
307
297
|
};
|
|
308
298
|
|
|
299
|
+
// ------------------------------------------- IO / File Management -------------------------------------------
|
|
300
|
+
|
|
301
|
+
getFile = (path: string): Promise<PlainObject<File>> =>
|
|
302
|
+
this.networkClient.get(
|
|
303
|
+
`${this.baseUrl}/fileAsJson/${path}`,
|
|
304
|
+
undefined,
|
|
305
|
+
undefined,
|
|
306
|
+
{
|
|
307
|
+
sessionId: this.sessionId,
|
|
308
|
+
mode: this.mode,
|
|
309
|
+
fastCompile: this.compilerMode,
|
|
310
|
+
},
|
|
311
|
+
);
|
|
312
|
+
|
|
313
|
+
getDirectoryChildren = (
|
|
314
|
+
path?: string,
|
|
315
|
+
): Promise<PlainObject<DirectoryNode>[]> =>
|
|
316
|
+
this.networkClient.get(`${this.baseUrl}/dir`, undefined, undefined, {
|
|
317
|
+
parameters: path ?? '/',
|
|
318
|
+
mode: this.mode,
|
|
319
|
+
sessionId: this.sessionId,
|
|
320
|
+
});
|
|
321
|
+
|
|
309
322
|
updateSource = (
|
|
310
323
|
updateInputs: UpdateSourceInput[],
|
|
311
324
|
): Promise<PlainObject<SourceModificationResult>> =>
|
|
@@ -361,6 +374,8 @@ export class PureClient {
|
|
|
361
374
|
},
|
|
362
375
|
);
|
|
363
376
|
|
|
377
|
+
// ------------------------------------------- Diagram -------------------------------------------
|
|
378
|
+
|
|
364
379
|
getDiagramInfo = async (
|
|
365
380
|
diagramPath: string,
|
|
366
381
|
): Promise<PlainObject<DiagramInfo>> =>
|
|
@@ -390,4 +405,40 @@ export class PureClient {
|
|
|
390
405
|
},
|
|
391
406
|
),
|
|
392
407
|
);
|
|
408
|
+
|
|
409
|
+
// ------------------------------------------- Suggestion -------------------------------------------
|
|
410
|
+
|
|
411
|
+
getSuggestionsForIncompletePath = (
|
|
412
|
+
currentPackagePath: string,
|
|
413
|
+
types: string[],
|
|
414
|
+
): Promise<PlainObject<ElementSuggestion>[]> =>
|
|
415
|
+
this.networkClient.post(`${this.baseUrl}/suggestion/incompletePath`, {
|
|
416
|
+
path: currentPackagePath,
|
|
417
|
+
types,
|
|
418
|
+
});
|
|
419
|
+
|
|
420
|
+
getSuggestionsForIdentifier = (
|
|
421
|
+
importPaths: string[],
|
|
422
|
+
types: string[],
|
|
423
|
+
): Promise<PlainObject<ElementSuggestion>[]> =>
|
|
424
|
+
this.networkClient.post(`${this.baseUrl}/suggestion/identifier`, {
|
|
425
|
+
importPaths,
|
|
426
|
+
types,
|
|
427
|
+
});
|
|
428
|
+
|
|
429
|
+
getSuggestionsForAttribute = (
|
|
430
|
+
importPaths: string[],
|
|
431
|
+
path: string,
|
|
432
|
+
): Promise<PlainObject<AttributeSuggestion>[]> =>
|
|
433
|
+
this.networkClient.post(`${this.baseUrl}/suggestion/attribute`, {
|
|
434
|
+
importPaths,
|
|
435
|
+
path,
|
|
436
|
+
});
|
|
437
|
+
|
|
438
|
+
getSuggestionsForClass = (
|
|
439
|
+
importPaths: string[],
|
|
440
|
+
): Promise<PlainObject<ClassSuggestion>[]> =>
|
|
441
|
+
this.networkClient.post(`${this.baseUrl}/suggestion/class`, {
|
|
442
|
+
importPaths,
|
|
443
|
+
});
|
|
393
444
|
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2020-present, Goldman Sachs
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { createModelSchema, list, optional, primitive } from 'serializr';
|
|
18
|
+
|
|
19
|
+
export class ElementSuggestion {
|
|
20
|
+
pureType!: string;
|
|
21
|
+
pureId!: string;
|
|
22
|
+
pureName!: string;
|
|
23
|
+
text!: string;
|
|
24
|
+
requiredClassProperties: string[] = [];
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
createModelSchema(ElementSuggestion, {
|
|
28
|
+
pureType: primitive(),
|
|
29
|
+
pureId: primitive(),
|
|
30
|
+
pureName: primitive(),
|
|
31
|
+
text: primitive(),
|
|
32
|
+
requiredClassProperties: optional(list(primitive())),
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
export class AttributeSuggestion {
|
|
36
|
+
pureType!: string;
|
|
37
|
+
pureName!: string;
|
|
38
|
+
owner!: string;
|
|
39
|
+
ownerPureType!: string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
createModelSchema(AttributeSuggestion, {
|
|
43
|
+
pureType: primitive(),
|
|
44
|
+
pureName: primitive(),
|
|
45
|
+
owner: primitive(),
|
|
46
|
+
ownerPureType: primitive(),
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
export class ClassSuggestion {
|
|
50
|
+
pureId!: string;
|
|
51
|
+
pureName!: string;
|
|
52
|
+
requiredClassProperties: string[] = [];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
createModelSchema(ClassSuggestion, {
|
|
56
|
+
pureId: primitive(),
|
|
57
|
+
pureName: primitive(),
|
|
58
|
+
requiredClassProperties: optional(list(primitive())),
|
|
59
|
+
});
|
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
import {
|
|
18
18
|
type CommandRegistrar,
|
|
19
19
|
EDITOR_LANGUAGE,
|
|
20
|
-
TAB_SIZE,
|
|
21
20
|
type TabState,
|
|
22
21
|
} from '@finos/legend-application';
|
|
23
22
|
import {
|
|
@@ -118,7 +117,7 @@ class FileTextEditorState {
|
|
|
118
117
|
fileEditorState.uuid,
|
|
119
118
|
this.language,
|
|
120
119
|
);
|
|
121
|
-
this.model.
|
|
120
|
+
this.model.setValue(fileEditorState.file.content);
|
|
122
121
|
}
|
|
123
122
|
|
|
124
123
|
// trigger for the manual observer of editor cursor
|
|
@@ -235,6 +234,7 @@ export class FileEditorState
|
|
|
235
234
|
|
|
236
235
|
setFile(val: File): void {
|
|
237
236
|
this.file = val;
|
|
237
|
+
this.textEditorState.model.setValue(val.content);
|
|
238
238
|
}
|
|
239
239
|
|
|
240
240
|
setShowGoToLinePrompt(val: boolean): void {
|