Skip to content

Commit

Permalink
Cleanup merge problems
Browse files Browse the repository at this point in the history
  • Loading branch information
joswarmer committed Sep 28, 2024
1 parent 703e907 commit 652450a
Show file tree
Hide file tree
Showing 15 changed files with 31 additions and 114 deletions.
2 changes: 1 addition & 1 deletion packages/core/src/change-manager/AstChanger.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { runInAction } from "mobx"
import { FreUndoManager } from "./FreUndoManager"
import { FreUndoManager } from "./FreUndoManager.js"

export type errorFunction = (msg: string) => void

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/change-manager/FreUndoManager.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FreLogger } from "../logging/index";
import { FreLogger } from "../logging/index.js";
import { FreChangeManager } from "./FreChangeManager.js";
import { FreModelUnit } from "../ast/index.js";
import { FreDelta } from "./FreDelta.js";
Expand Down
85 changes: 1 addition & 84 deletions packages/core/src/editor/actions/FreCommand.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Box } from "../boxes/index.js";
import { FreEditor } from "../FreEditor.js";
import { EMPTY_POST_ACTION, FrePostAction } from "./FreAction.js";
import { FreTriggerUse } from "./FreTriggers.js";
import { FreTriggerUse } from "./FreTriggers.js"
import { FreLogger } from "../../logging/index.js";

export const FRECOMMAND_LOGGER = new FreLogger("FreCommand"); // .mute();
Expand Down Expand Up @@ -52,86 +52,3 @@ class FreNullCommand extends FreCommand {
}

export const FRE_NULL_COMMAND: FreCommand = new FreNullCommand();

export type FreBinaryExpressionBuilder = (box: Box, text: string, editor: FreEditor) => FreBinaryExpression;

export class FreCreateBinaryExpressionCommand extends FreCommand {
expressionBuilder: FreBinaryExpressionBuilder;
boxRoleToSelect: string;
caretPosition: FreCaret;

constructor(expressionBuilder: FreBinaryExpressionBuilder) {
super();
this.expressionBuilder = expressionBuilder;
}

execute(box: Box, trigger: FreTriggerUse, editor: FreEditor): FrePostAction {
// console.log("FreCreateBinaryExpressionCommand: trigger [" + triggerTypeToString(trigger) + "] part: ");
const selected = BTREE.insertBinaryExpression(
this.expressionBuilder(box, triggerTypeToString(trigger), editor),
box,
editor,
);
// TODO Check whether this fix works consistently correct.
const childProperty = selected.boxRoleToSelect === FRE_BINARY_EXPRESSION_LEFT ? "left" : "right";
return function () {
LOGGER.log(
"FreCreateBinaryExpressionCommand select after: " +
selected.element.freLanguageConcept() +
" ID " +
selected.element.freId() +
" rolr " +
childProperty,
);
editor.selectElement(selected.element, childProperty);
editor.selectFirstEditableChildBox(selected.element);
};
}

// @ts-ignore
// parameters present to adhere to base class signature
undo() {
/* to be done */
}
}

export class FreCustomCommand extends FreCommand {
boxRoleToSelect: string;
caretPosition: FreCaret;
action: CustomAction;

constructor(action: CustomAction, boxRoleToSelect: string, caretPosition: FreCaret) {
super();
this.action = action;
this.boxRoleToSelect = boxRoleToSelect;
this.caretPosition = caretPosition;
}

execute(box: Box, trigger: FreTriggerUse, editor: FreEditor): FrePostAction {
// LOGGER.log("execute custom action, text is [" + text + "] refShort [" + this.referenceShortcut + "]" );
// console.log("FreCustomCommand: trigger [" + triggerTypeToString(trigger) + "]");
const self = this;
const selected = self.action(box, triggerTypeToString(trigger), editor);

if (!!selected) {
if (!!self.boxRoleToSelect) {
return function () {
// console.log("FreCommand select " + box.element.freLanguageConcept() + " box " + self.boxRoleToSelect);
editor.selectElementBox(selected, self.boxRoleToSelect, self.caretPosition);
};
} else {
// Default: select the first editable child of the selected element
return function () {
editor.selectFirstEditableChildBox(selected);
};
}
}
return EMPTY_POST_ACTION;
}

// @ts-ignore
// parameters present to adhere to base class signature
undo() {
/* to be done */
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { FreUtils } from "../../util/index.js";
import { Box } from "../boxes/index.js";
import { FreEditor } from "../FreEditor.js";
import { FreAction } from "./FreAction.js";
import { FreCommand, FreCreateBinaryExpressionCommand } from "./FreCommand.js";
import { FreCommand } from "./FreCommand.js";
import { FreCreateBinaryExpressionCommand } from "./FreCreateBinaryExpressionCommand.js";


Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { FreBinaryExpression } from "../../ast/index";
import { AST } from "../../change-manager/index";
import { BTREE, FRE_BINARY_EXPRESSION_LEFT, Selected } from "../../util/index";
import { Box } from "../boxes/index";
import { FreEditor } from "../FreEditor";
import { FreCaret } from "../util/index";
import { FrePostAction } from "./FreAction";
import { FreCommand, FRECOMMAND_LOGGER } from "./FreCommand";
import { FreTriggerUse, triggerTypeToString } from "./FreTriggers";
import { FreBinaryExpression } from "../../ast/index.js";
import { AST } from "../../change-manager/index.js";
import { BTREE, FRE_BINARY_EXPRESSION_LEFT, Selected } from "../../util/index.js";
import { Box } from "../boxes/index.js";
import { FreEditor } from "../FreEditor.js";
import { FreCaret } from "../util/index.js";
import { FrePostAction } from "./FreAction.js";
import { FreCommand, FRECOMMAND_LOGGER } from "./FreCommand.js";
import { FreTriggerUse, triggerTypeToString } from "./FreTriggers.js";

export type FreBinaryExpressionBuilder = (box: Box, text: string, editor: FreEditor) => FreBinaryExpression;

Expand Down
14 changes: 7 additions & 7 deletions packages/core/src/editor/actions/FreCustomCommand.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { AST } from "../../change-manager/index";
import { Box } from "../boxes/index";
import { FreEditor } from "../FreEditor";
import { FreCaret } from "../util/index";
import { CustomAction, EMPTY_POST_ACTION, FrePostAction } from "./FreAction";
import { FreCommand } from "./FreCommand";
import { FreTriggerUse, triggerTypeToString } from "./FreTriggers";
import { AST } from "../../change-manager/index.js";
import { Box } from "../boxes/index.js";
import { FreEditor } from "../FreEditor.js";
import { FreCaret } from "../util/index.js";
import { CustomAction, EMPTY_POST_ACTION, FrePostAction } from "./FreAction.js";
import { FreCommand } from "./FreCommand.js";
import { FreTriggerUse, triggerTypeToString } from "./FreTriggers.js";

export class FreCustomCommand extends FreCommand {
boxRoleToSelect: string;
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/editor/boxes/ButtonBox.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AST } from "../../change-manager/index";
import { AST } from "../../change-manager/index.js";
import { Box } from "./internal.js";
import { FreNode } from "../../ast/index.js";
import { FreLogger } from "../../logging/index.js";
Expand All @@ -7,7 +7,7 @@ import { BehaviorExecutionResult } from "../util/index.js";
import { FrePostAction } from "../actions/index.js";
import { FreEditor } from "../FreEditor.js";

const LOGGER: FreLogger = new FreLogger("ButtonBox"); //.mute();
const LOGGER: FreLogger = new FreLogger("ButtonBox").mute();

export class ButtonBox extends Box {
readonly kind: string = "ButtonBox";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AST } from "../../../change-manager/index";
import { AST } from "../../../change-manager/index.js";
import { Box } from "../Box.js";
import { FreNode } from "../../../ast/index.js";
import { FreUtils } from "../../../util/index.js";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AST } from "../../../change-manager/index";
import { AST } from "../../../change-manager/index.js";
import { Box } from "../Box.js";
import { FreNode } from "../../../ast/index.js";
import { FreUtils } from "../../../util/index.js";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AST } from "../../../change-manager/index";
import { AST } from "../../../change-manager/index.js";
import { Box } from "../Box.js";
import { FreNode } from "../../../ast/index.js";
import { FreUtils } from "../../../util/index.js";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { FreNode } from "../../../ast/index.js";
import { AST } from "../../../change-manager/index";
import { AST } from "../../../change-manager/index.js";
import {BoxFactory, LimitedControlBox, LimitedDisplay, SelectBox, SelectOption} from "../../boxes/index.js";
import { FreLanguage, FreLanguageProperty } from "../../../language/index.js";
import { UtilCheckers } from "./UtilCheckers.js";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { FreNode } from "../../../ast/index.js";
import { AST } from "../../../change-manager/index";
import { AST } from "../../../change-manager/index.js";
import {
BoolDisplay,
BooleanControlBox,
Expand All @@ -13,7 +13,7 @@ import {
SelectOption,
TextBox,
} from "../../boxes/index.js";
\import { FreEditor } from "../../FreEditor.js";
import { FreEditor } from "../../FreEditor.js";
import { BehaviorExecutionResult } from "../../util/index.js";
import { UtilCheckers } from "./UtilCheckers.js";
import { FreLanguage, FreLanguageProperty } from "../../../language/index.js";
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/editor/util/ListUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* They support drag-and-drop and cut/copy-paste functionality.
*/

import { AST } from "../../change-manager/index,js";
import { AST } from "../../change-manager/index.js"
import { jsonAsString } from "../../util/index.js";
// the following two imports are needed, to enable use of the names without the prefix 'Keys', avoiding 'Keys.MetaKey'
import * as Keys from "./Keys.js";
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/storage/InMemoryModel.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { FreModel, FreModelUnit } from "../ast/index.js";
import { AST } from "../change-manager/index";
import { AST } from "../change-manager/index.js";
import { FreEnvironment } from "../environment/index.js";
import { FreLogger } from "../logging/index.js";
import { IServerCommunication, ModelUnitIdentifier } from "./server/index.js";
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/storage/server/ServerCommunication.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { FreModelUnit, FreNamedNode, FreNode } from "../../ast/index.js";
import { FreLogger } from "../../logging/index.js";
import { FreLionwebSerializer, FreModelSerializer, FreSerializer } from "../index.js";
import { FreLionwebSerializer, FreModelSerializer } from "../index.js";
import { FreErrorSeverity } from "../../validator/index.js";
import { IServerCommunication, ModelUnitIdentifier } from "./IServerCommunication.js";

Expand Down

0 comments on commit 652450a

Please sign in to comment.