@finos/legend-application-studio 28.13.15 → 28.14.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 (36) hide show
  1. package/lib/__lib__/LegendStudioEvent.d.ts +4 -1
  2. package/lib/__lib__/LegendStudioEvent.d.ts.map +1 -1
  3. package/lib/__lib__/LegendStudioEvent.js +4 -0
  4. package/lib/__lib__/LegendStudioEvent.js.map +1 -1
  5. package/lib/components/editor/editor-group/EditorGroup.js +1 -1
  6. package/lib/components/editor/editor-group/EditorGroup.js.map +1 -1
  7. package/lib/components/editor/editor-group/GrammarTextEditor.d.ts.map +1 -1
  8. package/lib/components/editor/editor-group/GrammarTextEditor.js +258 -219
  9. package/lib/components/editor/editor-group/GrammarTextEditor.js.map +1 -1
  10. package/lib/components/workspace-setup/WorkspaceSetup.js +1 -1
  11. package/lib/components/workspace-setup/WorkspaceSetup.js.map +1 -1
  12. package/lib/index.css +2 -2
  13. package/lib/index.css.map +1 -1
  14. package/lib/package.json +1 -1
  15. package/lib/stores/editor/EditorGraphState.d.ts.map +1 -1
  16. package/lib/stores/editor/EditorGraphState.js +8 -1
  17. package/lib/stores/editor/EditorGraphState.js.map +1 -1
  18. package/lib/stores/editor/GraphEditFormModeState.js +1 -1
  19. package/lib/stores/editor/GraphEditFormModeState.js.map +1 -1
  20. package/lib/stores/editor/GraphEditGrammarModeState.d.ts +4 -0
  21. package/lib/stores/editor/GraphEditGrammarModeState.d.ts.map +1 -1
  22. package/lib/stores/editor/GraphEditGrammarModeState.js +29 -2
  23. package/lib/stores/editor/GraphEditGrammarModeState.js.map +1 -1
  24. package/lib/stores/editor/editor-state/GrammarTextEditorState.d.ts +2 -1
  25. package/lib/stores/editor/editor-state/GrammarTextEditorState.d.ts.map +1 -1
  26. package/lib/stores/editor/editor-state/GrammarTextEditorState.js +5 -2
  27. package/lib/stores/editor/editor-state/GrammarTextEditorState.js.map +1 -1
  28. package/package.json +1 -1
  29. package/src/__lib__/LegendStudioEvent.ts +5 -0
  30. package/src/components/editor/editor-group/EditorGroup.tsx +1 -1
  31. package/src/components/editor/editor-group/GrammarTextEditor.tsx +418 -355
  32. package/src/components/workspace-setup/WorkspaceSetup.tsx +1 -1
  33. package/src/stores/editor/EditorGraphState.ts +12 -0
  34. package/src/stores/editor/GraphEditFormModeState.ts +1 -1
  35. package/src/stores/editor/GraphEditGrammarModeState.ts +49 -1
  36. package/src/stores/editor/editor-state/GrammarTextEditorState.ts +7 -2
@@ -545,7 +545,7 @@ export const WorkspaceSetup = withWorkspaceSetupStore(
545
545
  .isConfigured
546
546
  }
547
547
  >
548
- {`Don't have a workspace?`}
548
+ {`Need to create a new workspace?`}
549
549
  </button>
550
550
  <div className="workspace-setup__actions__button">
551
551
  <button
@@ -88,6 +88,7 @@ import {
88
88
  createGraphBuilderReport,
89
89
  ExecutionEnvironmentInstance,
90
90
  SnowflakeApp,
91
+ GraphEntities,
91
92
  } from '@finos/legend-graph';
92
93
  import { CONFIGURATION_EDITOR_TAB } from './editor-state/project-configuration-editor-state/ProjectConfigurationEditorState.js';
93
94
  import { PACKAGEABLE_ELEMENT_TYPE } from './utils/ModelClassifierUtils.js';
@@ -169,6 +170,7 @@ export class EditorGraphState {
169
170
  loadEntityChangesToGraph: flow,
170
171
  updateGenerationGraphAndApplication: flow,
171
172
  rebuildDependencies: flow,
173
+ buildGraphForLazyText: flow,
172
174
  });
173
175
 
174
176
  this.editorStore = editorStore;
@@ -510,6 +512,16 @@ export class EditorGraphState {
510
512
  )) as Map<string, EntitiesWithOrigin>;
511
513
  stopWatch.record(GRAPH_MANAGER_EVENT.FETCH_GRAPH_DEPENDENCIES__SUCCESS);
512
514
  dependencyManager.initialize(dependencyEntitiesIndex);
515
+ // set dependency manager graph origin to entities
516
+ if (dependencyManager.origin === undefined) {
517
+ dependencyManager.setOrigin(
518
+ new GraphEntities(
519
+ Array.from(dependencyEntitiesIndex.values())
520
+ .map((e) => e.entities)
521
+ .flat(),
522
+ ),
523
+ );
524
+ }
513
525
  this.isInitializingGraph = false;
514
526
  this.editorStore.graphManagerState.dependenciesBuildState.sync(
515
527
  ActionState.create().pass(),
@@ -475,7 +475,7 @@ export class GraphEditFormModeState extends GraphEditorMode {
475
475
  if (!options?.disableNotificationOnSuccess) {
476
476
  if (this.editorStore.graphState.warnings.length) {
477
477
  this.editorStore.applicationStore.notificationService.notifyWarning(
478
- `Compilation suceeded with warnings`,
478
+ `Compilation succeeded with warnings`,
479
479
  );
480
480
  } else {
481
481
  if (!options?.disableNotificationOnSuccess) {
@@ -34,6 +34,7 @@ import {
34
34
  LogEvent,
35
35
  ActionState,
36
36
  StopWatch,
37
+ assertNonNullable,
37
38
  } from '@finos/legend-shared';
38
39
  import type { Entity } from '@finos/legend-storage';
39
40
  import { makeObservable, flow, flowResult, observable } from 'mobx';
@@ -48,6 +49,11 @@ import { graph_dispose } from '../graph-modifier/GraphModifierHelper.js';
48
49
  import { LegendStudioTelemetryHelper } from '../../__lib__/LegendStudioTelemetryHelper.js';
49
50
  import { GraphEditorMode } from './GraphEditorMode.js';
50
51
  import { ElementEditorState } from './editor-state/element-editor-state/ElementEditorState.js';
52
+ import { LEGEND_STUDIO_APP_EVENT } from '../../__lib__/LegendStudioEvent.js';
53
+
54
+ export enum GRAMMAR_MODE_EDITOR_ACTION {
55
+ GO_TO_ELEMENT_DEFINITION = 'go-to-element-definition',
56
+ }
51
57
 
52
58
  export class GraphEditGrammarModeState extends GraphEditorMode {
53
59
  grammarTextEditorState: GrammarTextEditorState;
@@ -57,6 +63,7 @@ export class GraphEditGrammarModeState extends GraphEditorMode {
57
63
  makeObservable(this, {
58
64
  grammarTextEditorState: observable,
59
65
  compileText: flow,
66
+ goToElement: flow,
60
67
  });
61
68
  this.grammarTextEditorState = new GrammarTextEditorState(this.editorStore);
62
69
  }
@@ -130,6 +137,47 @@ export class GraphEditGrammarModeState extends GraphEditorMode {
130
137
  }
131
138
  }
132
139
 
140
+ *goToElement(elementPath: string): GeneratorFn<void> {
141
+ try {
142
+ const sourceInformationIndex = new Map<string, SourceInformation>();
143
+ (yield this.editorStore.graphManagerState.graphManager.pureCodeToEntities(
144
+ this.grammarTextEditorState.graphGrammarText,
145
+ {
146
+ sourceInformationIndex,
147
+ },
148
+ )) as Entity[];
149
+ this.grammarTextEditorState.setSourceInformationIndex(
150
+ sourceInformationIndex,
151
+ );
152
+ const sourceInformation =
153
+ this.grammarTextEditorState.sourceInformationIndex.get(elementPath);
154
+ assertNonNullable(
155
+ sourceInformation,
156
+ `No definition found for current element in current grammar. Element may not exist of be defined in dependencies`,
157
+ );
158
+ this.grammarTextEditorState.setForcedCursorPosition({
159
+ lineNumber: sourceInformation.startLine,
160
+ column: 0,
161
+ });
162
+ this.editorStore.applicationStore.logService.info(
163
+ LogEvent.create(
164
+ LEGEND_STUDIO_APP_EVENT.TEXT_MODE_ACTION_KEYBOARD_SHORTCUT_GO_TO_DEFINITION__SUCCESS,
165
+ ),
166
+ );
167
+ } catch (error) {
168
+ assertErrorThrown(error);
169
+ this.editorStore.applicationStore.notificationService.notifyError(
170
+ `Unable to go to element ${elementPath}: ${error.message}`,
171
+ );
172
+ this.editorStore.applicationStore.logService.error(
173
+ LogEvent.create(
174
+ LEGEND_STUDIO_APP_EVENT.TEXT_MODE_ACTION_KEYBOARD_SHORTCUT_GO_TO_DEFINITION__ERROR,
175
+ ),
176
+ error,
177
+ );
178
+ }
179
+ }
180
+
133
181
  *compileText(
134
182
  options?: {
135
183
  onError?: () => void;
@@ -318,7 +366,7 @@ export class GraphEditGrammarModeState extends GraphEditorMode {
318
366
  if (!options?.disableNotificationOnSuccess) {
319
367
  if (this.editorStore.graphState.warnings.length) {
320
368
  this.editorStore.applicationStore.notificationService.notifyWarning(
321
- `Compilation suceeded with warnings`,
369
+ `Compilation succeeded with warnings`,
322
370
  );
323
371
  } else {
324
372
  if (!options?.disableNotificationOnSuccess) {
@@ -15,9 +15,9 @@
15
15
  */
16
16
 
17
17
  import type { EditorStore } from '../EditorStore.js';
18
- import { action, makeObservable, observable } from 'mobx';
18
+ import { action, computed, makeObservable, observable } from 'mobx';
19
19
  import { hashValue } from '@finos/legend-shared';
20
- import { type SourceInformation } from '@finos/legend-graph';
20
+ import type { SourceInformation } from '@finos/legend-graph';
21
21
  import { LEGEND_STUDIO_SETTING_KEY } from '../../../__lib__/LegendStudioSetting.js';
22
22
  import type { CodeEditorPosition } from '@finos/legend-lego/code-editor';
23
23
 
@@ -38,6 +38,7 @@ export class GrammarTextEditorState {
38
38
  setGraphGrammarText: action,
39
39
  setWrapText: action,
40
40
  setForcedCursorPosition: action,
41
+ wordWrapOtion: computed,
41
42
  });
42
43
 
43
44
  this.editorStore = editorStore;
@@ -51,6 +52,10 @@ export class GrammarTextEditorState {
51
52
  return hashValue(this.graphGrammarText);
52
53
  }
53
54
 
55
+ get wordWrapOtion(): 'on' | 'off' {
56
+ return this.wrapText ? 'on' : 'off';
57
+ }
58
+
54
59
  setGraphGrammarText(code: string): void {
55
60
  this.graphGrammarText = code;
56
61
  }