Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve node factories and copy-pasting in general #1190

Open
wants to merge 104 commits into
base: maintenance/mps20232
Choose a base branch
from

Conversation

alexanderpann
Copy link
Member

@alexanderpann alexanderpann commented Jan 7, 2025

I introduced 2 new interfaces: IContainAssignableExpression and IContainExpression and let many concepts implements them. When you now use the code completion menu to replace a node with another one, the expression is copied over to the new node.
Examples:

  • sin(10) -> cos(10)
  • 3.1415 -> sin(3.1415)

In addition, I implemented a lot of node factories to copy even more information from the old nodes.

For a few top-level expressions, I implemented experimental copy-paste handlers:

  • DotExpression -> IToplevelExprContent
  • Function -> Expression
  • Constant -> Expression
  • EnumLiteral -> Expression

Example: When you copy a function declaration, it will paste a reference to the function into the expression or a constant reference instead of the constant declaration itself.

As long as https://youtrack.jetbrains.com/issue/MPS-24089/copy-paste-handlers-are-not-called-for-extended-concepts is not implemented, it doesn't make sense to implement them for all concepts as it would lead to a lot of code duplication.

For reviewing: All changes related to the refactoring and introduction of those interfaces don't have to be reviewed since all the migrations where done automatically by MPS. I checked the project for broken references and I couldn't find any. Only the node factories and other commits have to be reviewed.
I will squash all the "use X for Y" commits after the review but kept it like that in case we need to remove some commits.

The first cell should rarely have set punctuation-left to true and the last cell should rarely have punctuation-right set to true if the collection is at the top of the editor.
…re/copy_paste_handlers

# Conflicts:
#	code/languages/org.iets3.opensource/solutions/org.iets3.core.expr.math.interpreter/org.iets3.core.expr.math.interpreter.msd
#	code/languages/org.iets3.opensource/tests/test.ts.expr.os/test.ts.expr.os.msd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant