@finos/legend-application-studio 21.0.1 → 22.1.0

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.
Files changed (123) hide show
  1. package/lib/components/DSL_ExternalFormat_LegendStudioApplicationPlugin.d.ts.map +1 -1
  2. package/lib/components/DSL_ExternalFormat_LegendStudioApplicationPlugin.js.map +1 -1
  3. package/lib/components/EditorComponentTestUtils.d.ts +9 -6
  4. package/lib/components/EditorComponentTestUtils.d.ts.map +1 -1
  5. package/lib/components/EditorComponentTestUtils.js +9 -6
  6. package/lib/components/EditorComponentTestUtils.js.map +1 -1
  7. package/lib/components/editor/edit-panel/GrammarTextEditor.d.ts.map +1 -1
  8. package/lib/components/editor/edit-panel/GrammarTextEditor.js +9 -200
  9. package/lib/components/editor/edit-panel/GrammarTextEditor.js.map +1 -1
  10. package/lib/components/editor/edit-panel/diff-editor/EntityChangeConflictEditor.d.ts.map +1 -1
  11. package/lib/components/editor/edit-panel/diff-editor/EntityChangeConflictEditor.js +5 -1
  12. package/lib/components/editor/edit-panel/diff-editor/EntityChangeConflictEditor.js.map +1 -1
  13. package/lib/components/editor/edit-panel/mapping-editor/MappingEditor.d.ts.map +1 -1
  14. package/lib/components/editor/edit-panel/mapping-editor/MappingEditor.js +1 -1
  15. package/lib/components/editor/edit-panel/mapping-editor/MappingEditor.js.map +1 -1
  16. package/lib/components/editor/edit-panel/project-configuration-editor/ProjectConfigurationEditor.d.ts.map +1 -1
  17. package/lib/components/editor/edit-panel/project-configuration-editor/ProjectConfigurationEditor.js +7 -139
  18. package/lib/components/editor/edit-panel/project-configuration-editor/ProjectConfigurationEditor.js.map +1 -1
  19. package/lib/components/editor/edit-panel/project-configuration-editor/ProjectDependencyEditor.d.ts +22 -0
  20. package/lib/components/editor/edit-panel/project-configuration-editor/ProjectDependencyEditor.d.ts.map +1 -0
  21. package/lib/components/editor/edit-panel/project-configuration-editor/ProjectDependencyEditor.js +282 -0
  22. package/lib/components/editor/edit-panel/project-configuration-editor/ProjectDependencyEditor.js.map +1 -0
  23. package/lib/components/editor/edit-panel/service-editor/ServiceEditor.d.ts.map +1 -1
  24. package/lib/components/editor/edit-panel/service-editor/ServiceEditor.js +3 -3
  25. package/lib/components/editor/edit-panel/service-editor/ServiceEditor.js.map +1 -1
  26. package/lib/components/editor/edit-panel/service-editor/ServiceExecutionEditor.d.ts.map +1 -1
  27. package/lib/components/editor/edit-panel/service-editor/ServiceExecutionEditor.js +0 -1
  28. package/lib/components/editor/edit-panel/service-editor/ServiceExecutionEditor.js.map +1 -1
  29. package/lib/components/editor/edit-panel/service-editor/ServiceExecutionQueryEditor.d.ts.map +1 -1
  30. package/lib/components/editor/edit-panel/service-editor/ServiceExecutionQueryEditor.js +7 -3
  31. package/lib/components/editor/edit-panel/service-editor/ServiceExecutionQueryEditor.js.map +1 -1
  32. package/lib/components/editor/edit-panel/service-editor/testable/ServiceTestableEditor.d.ts +3 -1
  33. package/lib/components/editor/edit-panel/service-editor/testable/ServiceTestableEditor.d.ts.map +1 -1
  34. package/lib/components/editor/edit-panel/service-editor/testable/ServiceTestableEditor.js +19 -2
  35. package/lib/components/editor/edit-panel/service-editor/testable/ServiceTestableEditor.js.map +1 -1
  36. package/lib/index.css +2 -2
  37. package/lib/index.css.map +1 -1
  38. package/lib/package.json +1 -1
  39. package/lib/stores/DSL_Data_LegendStudioApplicationPlugin_Extension.d.ts +2 -1
  40. package/lib/stores/DSL_Data_LegendStudioApplicationPlugin_Extension.d.ts.map +1 -1
  41. package/lib/stores/EditorGraphState.d.ts.map +1 -1
  42. package/lib/stores/EditorGraphState.js +9 -6
  43. package/lib/stores/EditorGraphState.js.map +1 -1
  44. package/lib/stores/EditorTabManagerState.d.ts +0 -2
  45. package/lib/stores/EditorTabManagerState.d.ts.map +1 -1
  46. package/lib/stores/EditorTabManagerState.js +1 -32
  47. package/lib/stores/EditorTabManagerState.js.map +1 -1
  48. package/lib/stores/LegendStudioApplicationPlugin.d.ts +1 -48
  49. package/lib/stores/LegendStudioApplicationPlugin.d.ts.map +1 -1
  50. package/lib/stores/LegendStudioApplicationPlugin.js.map +1 -1
  51. package/lib/stores/STO_Relational_LegendStudioApplicationPlugin_Extension.d.ts +2 -1
  52. package/lib/stores/STO_Relational_LegendStudioApplicationPlugin_Extension.d.ts.map +1 -1
  53. package/lib/stores/editor-state/EditorState.d.ts +0 -5
  54. package/lib/stores/editor-state/EditorState.d.ts.map +1 -1
  55. package/lib/stores/editor-state/EditorState.js.map +1 -1
  56. package/lib/stores/editor-state/FileGenerationViewerState.d.ts.map +1 -1
  57. package/lib/stores/editor-state/FileGenerationViewerState.js.map +1 -1
  58. package/lib/stores/editor-state/ModelImporterState.d.ts.map +1 -1
  59. package/lib/stores/editor-state/ModelImporterState.js.map +1 -1
  60. package/lib/stores/editor-state/ProjectConfigurationEditorState.d.ts +22 -9
  61. package/lib/stores/editor-state/ProjectConfigurationEditorState.d.ts.map +1 -1
  62. package/lib/stores/editor-state/ProjectConfigurationEditorState.js +93 -51
  63. package/lib/stores/editor-state/ProjectConfigurationEditorState.js.map +1 -1
  64. package/lib/stores/editor-state/element-editor-state/ElementEditorState.d.ts +1 -0
  65. package/lib/stores/editor-state/element-editor-state/ElementEditorState.d.ts.map +1 -1
  66. package/lib/stores/editor-state/element-editor-state/ElementEditorState.js +3 -0
  67. package/lib/stores/editor-state/element-editor-state/ElementEditorState.js.map +1 -1
  68. package/lib/stores/editor-state/element-editor-state/service/ServiceEditorState.d.ts.map +1 -1
  69. package/lib/stores/editor-state/element-editor-state/service/ServiceEditorState.js +7 -2
  70. package/lib/stores/editor-state/element-editor-state/service/ServiceEditorState.js.map +1 -1
  71. package/lib/stores/editor-state/element-editor-state/service/ServiceExecutionState.d.ts +7 -1
  72. package/lib/stores/editor-state/element-editor-state/service/ServiceExecutionState.d.ts.map +1 -1
  73. package/lib/stores/editor-state/element-editor-state/service/ServiceExecutionState.js +55 -15
  74. package/lib/stores/editor-state/element-editor-state/service/ServiceExecutionState.js.map +1 -1
  75. package/lib/stores/editor-state/element-editor-state/service/testable/ServiceTestDataState.d.ts.map +1 -1
  76. package/lib/stores/editor-state/element-editor-state/service/testable/ServiceTestDataState.js +3 -2
  77. package/lib/stores/editor-state/element-editor-state/service/testable/ServiceTestDataState.js.map +1 -1
  78. package/lib/stores/editor-state/element-editor-state/service/testable/ServiceTestEditorState.d.ts +2 -0
  79. package/lib/stores/editor-state/element-editor-state/service/testable/ServiceTestEditorState.d.ts.map +1 -1
  80. package/lib/stores/editor-state/element-editor-state/service/testable/ServiceTestEditorState.js +8 -4
  81. package/lib/stores/editor-state/element-editor-state/service/testable/ServiceTestEditorState.js.map +1 -1
  82. package/lib/stores/editor-state/entity-diff-editor-state/EntityChangeConflictEditorState.d.ts.map +1 -1
  83. package/lib/stores/editor-state/entity-diff-editor-state/EntityChangeConflictEditorState.js.map +1 -1
  84. package/lib/stores/editor-state/entity-diff-editor-state/EntityDiffViewState.d.ts.map +1 -1
  85. package/lib/stores/editor-state/entity-diff-editor-state/EntityDiffViewState.js.map +1 -1
  86. package/lib/stores/shared/FileGenerationTreeUtils.d.ts +1 -2
  87. package/lib/stores/shared/FileGenerationTreeUtils.d.ts.map +1 -1
  88. package/lib/stores/shared/FileGenerationTreeUtils.js +1 -1
  89. package/lib/stores/shared/FileGenerationTreeUtils.js.map +1 -1
  90. package/lib/stores/shared/modifier/DSL_Service_GraphModifierHelper.d.ts.map +1 -1
  91. package/lib/stores/shared/modifier/DSL_Service_GraphModifierHelper.js +3 -1
  92. package/lib/stores/shared/modifier/DSL_Service_GraphModifierHelper.js.map +1 -1
  93. package/package.json +10 -10
  94. package/src/components/DSL_ExternalFormat_LegendStudioApplicationPlugin.tsx +4 -2
  95. package/src/components/EditorComponentTestUtils.tsx +12 -9
  96. package/src/components/editor/edit-panel/GrammarTextEditor.tsx +28 -219
  97. package/src/components/editor/edit-panel/diff-editor/EntityChangeConflictEditor.tsx +5 -1
  98. package/src/components/editor/edit-panel/mapping-editor/MappingEditor.tsx +2 -5
  99. package/src/components/editor/edit-panel/project-configuration-editor/ProjectConfigurationEditor.tsx +5 -397
  100. package/src/components/editor/edit-panel/project-configuration-editor/ProjectDependencyEditor.tsx +724 -0
  101. package/src/components/editor/edit-panel/service-editor/ServiceEditor.tsx +4 -3
  102. package/src/components/editor/edit-panel/service-editor/ServiceExecutionEditor.tsx +0 -5
  103. package/src/components/editor/edit-panel/service-editor/ServiceExecutionQueryEditor.tsx +10 -5
  104. package/src/components/editor/edit-panel/service-editor/testable/ServiceTestableEditor.tsx +63 -2
  105. package/src/stores/DSL_Data_LegendStudioApplicationPlugin_Extension.ts +2 -4
  106. package/src/stores/EditorGraphState.ts +16 -10
  107. package/src/stores/EditorTabManagerState.ts +1 -40
  108. package/src/stores/LegendStudioApplicationPlugin.ts +1 -49
  109. package/src/stores/STO_Relational_LegendStudioApplicationPlugin_Extension.ts +2 -4
  110. package/src/stores/editor-state/EditorState.ts +0 -6
  111. package/src/stores/editor-state/FileGenerationViewerState.ts +1 -1
  112. package/src/stores/editor-state/ModelImporterState.ts +1 -1
  113. package/src/stores/editor-state/ProjectConfigurationEditorState.ts +118 -67
  114. package/src/stores/editor-state/element-editor-state/ElementEditorState.ts +5 -1
  115. package/src/stores/editor-state/element-editor-state/service/ServiceEditorState.ts +12 -1
  116. package/src/stores/editor-state/element-editor-state/service/ServiceExecutionState.ts +93 -36
  117. package/src/stores/editor-state/element-editor-state/service/testable/ServiceTestDataState.ts +5 -2
  118. package/src/stores/editor-state/element-editor-state/service/testable/ServiceTestEditorState.ts +8 -4
  119. package/src/stores/editor-state/entity-diff-editor-state/EntityChangeConflictEditorState.ts +1 -1
  120. package/src/stores/editor-state/entity-diff-editor-state/EntityDiffViewState.ts +1 -1
  121. package/src/stores/shared/FileGenerationTreeUtils.ts +4 -2
  122. package/src/stores/shared/modifier/DSL_Service_GraphModifierHelper.ts +3 -1
  123. package/tsconfig.json +1 -0
@@ -46,13 +46,13 @@ import {
46
46
  service_setPattern,
47
47
  service_updateOwner,
48
48
  } from '../../../../stores/shared/modifier/DSL_Service_GraphModifierHelper.js';
49
- import { validate_ServicePattern } from '@finos/legend-graph';
50
- import { ServiceTestableEditor } from './testable/ServiceTestableEditor.js';
51
49
  import {
52
50
  LEGEND_APPLICATION_DOCUMENTATION_KEY,
53
51
  useApplicationNavigationContext,
54
52
  useApplicationStore,
55
53
  } from '@finos/legend-application';
54
+ import { validate_ServicePattern } from '@finos/legend-graph';
55
+ import { ServiceTestableWrapperEditor } from './testable/ServiceTestableEditor.js';
56
56
  import { LEGEND_STUDIO_APPLICATION_NAVIGATION_CONTEXT_KEY } from '../../../../stores/LegendStudioApplicationNavigationContext.js';
57
57
 
58
58
  const ServiceGeneralEditor = observer(() => {
@@ -475,8 +475,9 @@ export const ServiceEditor = observer(() => {
475
475
  <ServiceRegistrationEditor />
476
476
  )}
477
477
  {selectedTab === SERVICE_TAB.TEST && (
478
- <ServiceTestableEditor
478
+ <ServiceTestableWrapperEditor
479
479
  serviceTestableState={serviceState.testableState}
480
+ serviceExecution={service.execution}
480
481
  />
481
482
  )}
482
483
  </div>
@@ -64,7 +64,6 @@ import { useEditorStore } from '../../EditorStoreProvider.js';
64
64
  import {
65
65
  type KeyedExecutionParameter,
66
66
  type Runtime,
67
- type ServiceTest,
68
67
  Mapping,
69
68
  RuntimePointer,
70
69
  PackageableRuntime,
@@ -778,10 +777,6 @@ const ServicePureExecutionEditor = observer(
778
777
  servicePureExecutionState instanceof MultiServicePureExecutionState;
779
778
  const showChangeExecutionModal = (): void => {
780
779
  if (servicePureExecutionState instanceof MultiServicePureExecutionState) {
781
- servicePureExecutionState.serviceEditorState.service.tests.forEach(
782
- (suite) =>
783
- suite.tests.forEach((st) => ((st as ServiceTest).keys = [])),
784
- );
785
780
  servicePureExecutionState.setSingleExecutionKey(
786
781
  servicePureExecutionState.execution.executionParameters[0],
787
782
  );
@@ -257,7 +257,12 @@ export const ServiceExecutionQueryEditor = observer(
257
257
  const service = executionState.serviceEditorState.service;
258
258
  const selectedExecutionState =
259
259
  executionState.selectedExecutionContextState;
260
- if (selectedExecutionState) {
260
+ if (selectedExecutionState?.executionContext.mapping === undefined) {
261
+ applicationStore.notifyError(
262
+ 'Editing query without runtime and mapping is unsupported via query builder, please leverage the text mode to edit query',
263
+ );
264
+ executionState.setOpeningQueryEditor(false);
265
+ } else {
261
266
  const mapping = selectedExecutionState.executionContext.mapping.value;
262
267
  if (!isStubbed_PackageableElement(mapping)) {
263
268
  await flowResult(
@@ -327,11 +332,11 @@ export const ServiceExecutionQueryEditor = observer(
327
332
  executionState.setOpeningQueryEditor(false);
328
333
  return;
329
334
  }
335
+ applicationStore.notifyWarning(
336
+ 'Please specify a mapping and a runtime for the execution context to edit with query builder',
337
+ );
338
+ executionState.setOpeningQueryEditor(false);
330
339
  }
331
- applicationStore.notifyWarning(
332
- 'Please specify a mapping and a runtime for the execution context to edit with query builder',
333
- );
334
- executionState.setOpeningQueryEditor(false);
335
340
  },
336
341
  );
337
342
  const importQuery = (): void => {
@@ -24,10 +24,16 @@ import {
24
24
  ContextMenu,
25
25
  Dialog,
26
26
  BlankPanelPlaceholder,
27
+ Panel,
28
+ LockIcon,
27
29
  ModalTitle,
28
30
  } from '@finos/legend-art';
29
31
  import { observer } from 'mobx-react-lite';
30
- import type { ServiceTestSuite } from '@finos/legend-graph';
32
+ import {
33
+ PureSingleExecution,
34
+ type ServiceExecution,
35
+ type ServiceTestSuite,
36
+ } from '@finos/legend-graph';
31
37
  import { ServiceTestDataEditor } from './ServiceTestDataEditor.js';
32
38
  import { ServiceTestsEditor } from './ServiceTestsEditor.js';
33
39
  import { forwardRef, useState } from 'react';
@@ -39,6 +45,7 @@ import type {
39
45
  } from '../../../../../stores/editor-state/element-editor-state/service/testable/ServiceTestableState.js';
40
46
  import { useApplicationNavigationContext } from '@finos/legend-application';
41
47
  import { LEGEND_STUDIO_APPLICATION_NAVIGATION_CONTEXT_KEY } from '../../../../../stores/LegendStudioApplicationNavigationContext.js';
48
+ import { UnsupportedEditorPanel } from '../../UnsupportedElementEditor.js';
42
49
 
43
50
  export const ServiceTestSuiteEditor = observer(
44
51
  (props: { serviceTestSuiteState: ServiceTestSuiteState }) => {
@@ -143,7 +150,7 @@ export const RenameModal = observer(
143
150
  },
144
151
  );
145
152
 
146
- export const ServiceTestableEditor = observer(
153
+ const ServiceTestableEditor = observer(
147
154
  (props: { serviceTestableState: ServiceTestableState }) => {
148
155
  const { serviceTestableState } = props;
149
156
  const serviceEditorState = serviceTestableState.serviceEditorState;
@@ -238,3 +245,57 @@ export const ServiceTestableEditor = observer(
238
245
  );
239
246
  },
240
247
  );
248
+
249
+ const ServiceTestableUnsupportedEditor = observer(
250
+ (props: { serviceTestableState: ServiceTestableState }) => {
251
+ const { serviceTestableState } = props;
252
+ const serviceEditorState = serviceTestableState.serviceEditorState;
253
+ const isReadOnly = serviceEditorState.isReadOnly;
254
+ return (
255
+ <div className="unsupported-element-editor">
256
+ <Panel>
257
+ <div className="panel__header">
258
+ <div className="panel__header__title">
259
+ {isReadOnly && (
260
+ <div className="uml-element-editor__header__lock">
261
+ <LockIcon />
262
+ </div>
263
+ )}
264
+ <div className="panel__header__title__label">Service Tests</div>
265
+ </div>
266
+ </div>
267
+ <div className="panel__content unsupported-element-editor__content">
268
+ <UnsupportedEditorPanel
269
+ text="Service Test Editor does not support services with no mapping and runtime. Please edit in text mode."
270
+ isReadOnly={isReadOnly}
271
+ />
272
+ </div>
273
+ </Panel>
274
+ </div>
275
+ );
276
+ },
277
+ );
278
+
279
+ export const ServiceTestableWrapperEditor = observer(
280
+ (props: {
281
+ serviceTestableState: ServiceTestableState;
282
+ serviceExecution: ServiceExecution;
283
+ }) => {
284
+ if (
285
+ props.serviceExecution instanceof PureSingleExecution &&
286
+ props.serviceExecution.runtime
287
+ ) {
288
+ return (
289
+ <ServiceTestableEditor
290
+ serviceTestableState={props.serviceTestableState}
291
+ />
292
+ );
293
+ } else {
294
+ return (
295
+ <ServiceTestableUnsupportedEditor
296
+ serviceTestableState={props.serviceTestableState}
297
+ />
298
+ );
299
+ }
300
+ },
301
+ );
@@ -14,14 +14,12 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
+ import type { ElementEmbeddedContentSnippetSuggestion } from '@finos/legend-application';
17
18
  import type { EmbeddedData } from '@finos/legend-graph';
18
19
  import type { EmbeddedDataTypeOption } from './editor-state/element-editor-state/data/DataEditorState.js';
19
20
  import type { EmbeddedDataState } from './editor-state/element-editor-state/data/EmbeddedDataState.js';
20
21
  import type { EditorStore } from './EditorStore.js';
21
- import type {
22
- DSL_LegendStudioApplicationPlugin_Extension,
23
- ElementEmbeddedContentSnippetSuggestion,
24
- } from './LegendStudioApplicationPlugin.js';
22
+ import type { DSL_LegendStudioApplicationPlugin_Extension } from './LegendStudioApplicationPlugin.js';
25
23
 
26
24
  export type EmbeddedDataEditorStateBuilder = (
27
25
  editorStore: EditorStore,
@@ -53,10 +53,12 @@ import {
53
53
  applyEntityChanges,
54
54
  } from '@finos/legend-server-sdlc';
55
55
  import {
56
+ type ProjectDependencyGraphReport,
56
57
  ProjectVersionEntities,
57
58
  ProjectData,
58
59
  ProjectDependencyCoordinates,
59
- ProjectDependencyInfo,
60
+ RawProjectDependencyReport,
61
+ buildDependencyReport,
60
62
  } from '@finos/legend-server-depot';
61
63
  import {
62
64
  GRAPH_MANAGER_EVENT,
@@ -96,10 +98,7 @@ import {
96
98
  ActionAlertActionType,
97
99
  ActionAlertType,
98
100
  } from '@finos/legend-application';
99
- import {
100
- CONFIGURATION_EDITOR_TAB,
101
- getConflictsString,
102
- } from './editor-state/ProjectConfigurationEditorState.js';
101
+ import { CONFIGURATION_EDITOR_TAB } from './editor-state/ProjectConfigurationEditorState.js';
103
102
  import { graph_dispose } from './shared/modifier/GraphModifierHelper.js';
104
103
  import { PACKAGEABLE_ELEMENT_TYPE } from './shared/ModelClassifierUtils.js';
105
104
  import { GlobalTestRunnerState } from './sidebar-state/testable/GlobalTestRunnerState.js';
@@ -1179,7 +1178,7 @@ export class EditorGraphState {
1179
1178
  ([k, v]) => v.size > 1,
1180
1179
  );
1181
1180
  if (hasConflicts) {
1182
- let dependencyInfo: ProjectDependencyInfo | undefined;
1181
+ let dependencyInfo: ProjectDependencyGraphReport | undefined;
1183
1182
  try {
1184
1183
  const dependencyTree =
1185
1184
  await this.editorStore.depotServerClient.analyzeDependencyTree(
@@ -1187,8 +1186,9 @@ export class EditorGraphState {
1187
1186
  ProjectDependencyCoordinates.serialization.toJson(e),
1188
1187
  ),
1189
1188
  );
1190
- dependencyInfo =
1191
- ProjectDependencyInfo.serialization.fromJson(dependencyTree);
1189
+ const rawReport =
1190
+ RawProjectDependencyReport.serialization.fromJson(dependencyTree);
1191
+ dependencyInfo = buildDependencyReport(rawReport);
1192
1192
  } catch (error) {
1193
1193
  assertErrorThrown(error);
1194
1194
  this.editorStore.applicationStore.log.error(
@@ -1198,9 +1198,15 @@ export class EditorGraphState {
1198
1198
  }
1199
1199
  const startErrorMessage =
1200
1200
  'Depending on multiple versions of a project is not supported. Found conflicts:\n';
1201
- if (dependencyInfo?.conflicts) {
1201
+ if (dependencyInfo?.conflicts.length) {
1202
+ const conflictingProjects = dependencyInfo.conflicts.map(
1203
+ (c) =>
1204
+ `project: ${c.groupId}:${c.artifactId}\nverions:[${c.versions
1205
+ .map((v) => v.versionId)
1206
+ .join(',')}]`,
1207
+ );
1202
1208
  throw new UnsupportedOperationError(
1203
- startErrorMessage + getConflictsString(dependencyInfo),
1209
+ startErrorMessage + conflictingProjects,
1204
1210
  );
1205
1211
  } else {
1206
1212
  const conflictMessages = Array.from(dependencyProjects.entries())
@@ -16,12 +16,7 @@
16
16
 
17
17
  import { TabManagerState } from '@finos/legend-application';
18
18
  import { Package, type PackageableElement } from '@finos/legend-graph';
19
- import {
20
- assertTrue,
21
- type Clazz,
22
- guaranteeType,
23
- isNonNullable,
24
- } from '@finos/legend-shared';
19
+ import { type Clazz, guaranteeType, isNonNullable } from '@finos/legend-shared';
25
20
  import { makeObservable, action } from 'mobx';
26
21
  import type { EditorState } from './editor-state/EditorState.js';
27
22
  import { ElementEditorState } from './editor-state/element-editor-state/ElementEditorState.js';
@@ -53,40 +48,6 @@ export class EditorTabManagerState extends TabManagerState {
53
48
  return 'editor.tab-manager.tab';
54
49
  }
55
50
 
56
- closeTab(tab: EditorState): void {
57
- const elementIndex = this.tabs.findIndex((e) => e === tab);
58
- assertTrue(elementIndex !== -1, `Can't close a tab which is not opened`);
59
- this.tabs.splice(elementIndex, 1);
60
- if (this.currentTab === tab) {
61
- if (this.tabs.length) {
62
- const openIndex = elementIndex - 1;
63
- this.setCurrentTab(
64
- openIndex >= 0 ? this.tabs[openIndex] : this.tabs[0],
65
- );
66
- } else {
67
- this.setCurrentTab(undefined);
68
- }
69
- }
70
- }
71
-
72
- openTab(tab: EditorState): void {
73
- const existingTab = this.tabs.find((t) => t.match(tab));
74
- if (!existingTab) {
75
- if (this.currentTab) {
76
- const currIndex = this.tabs.findIndex((e) => e === this.currentTab);
77
- this.tabs.splice(currIndex + 1, 0, tab);
78
- } else {
79
- this.tabs.push(tab);
80
- }
81
- }
82
- this.setCurrentTab(tab);
83
-
84
- if (tab instanceof ElementEditorState) {
85
- // expand tree node
86
- this.editorStore.explorerTreeState.openNode(tab.element);
87
- }
88
- }
89
-
90
51
  getCurrentEditorState<T extends EditorState>(clazz: Clazz<T>): T {
91
52
  return guaranteeType(
92
53
  this.currentTab,
@@ -24,6 +24,7 @@ import type {
24
24
  import type { Class, PackageableElement, Testable } from '@finos/legend-graph';
25
25
  import {
26
26
  type DocumentationEntry,
27
+ type PureGrammarTextSuggestion,
27
28
  LegendApplicationPlugin,
28
29
  } from '@finos/legend-application';
29
30
  import type { TestableMetadata } from './sidebar-state/testable/GlobalTestRunnerState.js';
@@ -180,55 +181,6 @@ export type PureGrammarParserElementDocumentationGetter = (
180
181
  elementKeyword: string,
181
182
  ) => DocumentationEntry | undefined;
182
183
 
183
- /**
184
- * This snippet suggestion is meant for an embedded content of an element
185
- * In other words, it is used to construct element snippet suggestions
186
- *
187
- * Because of that, it is expected that there are text content wrapping around
188
- * this snippet, so the first suggestion might not start from index 1.
189
- */
190
- export interface ElementEmbeddedContentSnippetSuggestion {
191
- /**
192
- * Brief description about the suggestion item to enable the users to quickly
193
- * differentiate between one suggestions from another
194
- */
195
- description?: string | undefined;
196
- /**
197
- * The snippet text to be embedded in the full snippet suggestion text for the element
198
- *
199
- * NOTE: The snippet syntax follows that of `monaco-editor`
200
- * See https://code.visualstudio.com/docs/editor/userdefinedsnippets#_create-your-own-snippets
201
- */
202
- text: string;
203
- }
204
-
205
- /**
206
- * This mirrors `monaco-editor` completion item structure
207
- * See https://microsoft.github.io/monaco-editor/api/interfaces/monaco.languages.CompletionItem.html
208
- */
209
- export interface PureGrammarTextSuggestion {
210
- /**
211
- * The text label of the suggestion.
212
- */
213
- text: string;
214
- /**
215
- * Brief description about the suggestion item to enable the users to quickly
216
- * differentiate between one suggestions from another
217
- */
218
- description?: string | undefined;
219
- /**
220
- * Detailed documentation that explains/elaborates the suggestion item.
221
- */
222
- documentation?: DocumentationEntry | undefined;
223
- /**
224
- * A string or snippet that should be inserted when selecting this suggestion.
225
- *
226
- * NOTE: The snippet syntax follows that of `monaco-editor`
227
- * See https://code.visualstudio.com/docs/editor/userdefinedsnippets#_create-your-own-snippets
228
- */
229
- insertText: string;
230
- }
231
-
232
184
  export type PureGrammarParserKeywordSuggestionGetter = (
233
185
  editorStore: EditorStore,
234
186
  ) => PureGrammarTextSuggestion[];
@@ -14,10 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import type {
18
- DSL_LegendStudioApplicationPlugin_Extension,
19
- ElementEmbeddedContentSnippetSuggestion,
20
- } from './LegendStudioApplicationPlugin.js';
17
+ import type { DSL_LegendStudioApplicationPlugin_Extension } from './LegendStudioApplicationPlugin.js';
21
18
  import type {
22
19
  DatasourceSpecification,
23
20
  AuthenticationStrategy,
@@ -26,6 +23,7 @@ import type {
26
23
  } from '@finos/legend-graph';
27
24
  import type { RelationalDatabaseConnectionValueState } from './editor-state/element-editor-state/connection/ConnectionEditorState.js';
28
25
  import type { PostProcessorEditorState } from './editor-state/element-editor-state/connection/PostProcessorEditorState.js';
26
+ import type { ElementEmbeddedContentSnippetSuggestion } from '@finos/legend-application';
29
27
 
30
28
  /**
31
29
  * NOTE: The tab-stop index of the snippet must start from 6
@@ -24,10 +24,4 @@ export abstract class EditorState extends TabState {
24
24
  super();
25
25
  this.editorStore = editorStore;
26
26
  }
27
-
28
- /**
29
- * Check if the specified tab this tab or not.
30
- * This is often used when checking if a tab is already opened.
31
- */
32
- abstract match(tab: EditorState): boolean;
33
27
  }
@@ -68,7 +68,7 @@ export class FileGenerationViewerState extends EditorState {
68
68
  return this.file.name;
69
69
  }
70
70
 
71
- match(tab: EditorState): boolean {
71
+ override match(tab: EditorState): boolean {
72
72
  return tab instanceof FileGenerationViewerState && tab.file === this.file;
73
73
  }
74
74
  }
@@ -477,7 +477,7 @@ export class ModelImporterState extends EditorState {
477
477
  return 'Model Importer';
478
478
  }
479
479
 
480
- match(tab: EditorState): boolean {
480
+ override match(tab: EditorState): boolean {
481
481
  return tab instanceof ModelImporterEditorState;
482
482
  }
483
483