Repository navigation
Conversation
…ttern changes A completion menu opened by typing next to a cell offers the side transforms of that border. When the pattern changed, the entries were rebuilt from the substitute actions of the anchor cell instead, so the side transforms were lost after the first key and a transform longer than one character could never be completed by typing it. The update now reuses the providers of the menu that was opened, as hasCodeCompletionActions already does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Node attributes (jetbrains.mps.lang.core.structure.NodeAttribute) wrap the
cell of the node they are attached to, the first attribute outermost as in
MPS. The notation of an attribute says where that node goes with the new
`attributed` cell.
Each layer is an ordinary cell creation call. The `attributed` cell derives
the next layer inward from the model (the attribute's parent and its next
attribute), so nothing is handed down while rendering and adding or removing
an attribute only rebuilds the layers next to it. An attribute whose notation
has no `attributed` cell is not rendered, and its check messages stay on the
attributed node. Without any notation the reflective editor shows it around
the node. The reflective editor no longer lists `smodelAttribute` as a child
role.
Adding an attribute needs no intention: typing the first constant in front of
the `attributed` cell in front of a node adds it, and the first constant
behind it behind the node. Where the caret is decides how it nests with the
existing ones, the attributed concepts and `multiple` of the attribute info
are respected, and where several nodes start at the same position the
outermost one gets it. Deleting the attribute's own text removes it and keeps
the node.
In the notation language, `AttributedCell` is generated to
`attributed { attributedConcept(...); multiple(...) }` from the concept's
`@attribute info`. ReviewMigration gets a notation that uses it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Test Results726 tests 713 ✅ 8m 45s ⏱️ Results for commit 49acba9. ♻️ This comment has been updated with latest results. |
Rendering the editor after a model change ran the typesystem and constraints checks of the whole root node while holding the incremental engine's lock. An edit like pressing Enter had to wait for it, which took more than two seconds in larger root nodes. The editor now only reads the messages published by the last completed check. The checks run in the background in an incremental engine of their own and in a read action that a write action cancels. The messages are published per node, so a new check result only re-renders the cells of the affected nodes. IncrementalModelChecker can now be cancelled. MPS executes model access in a non-cancelable section, so the cancellation is checked explicitly instead of through the ProgressManager. Cancelled checks are re-executed after retryCancelledChecks() instead of staying cached as failed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… is open Services are disposed inside a write action. Stopping the Ktor server there waited for the Netty event loops, without any timeout, while a request handler on one of them waited for a read action. MPS could only be killed. The servers are now stopped when the application is about to close or the plugin is about to be unloaded, which is before that write action. Stopping them in dispose() remains as a fallback and gives up after a bounded time. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A reference cell generated from an MPS notation writes its target as NodePresentationUtil.presentation, which ends in SNode.getPresentation(). ModelixNodeAsMPSNode answered that with the stored name and otherwise with the toString() of the modelix node. A target whose name is derived by a property getter in the constraints, like an optionally named BlockInstance, has no stored name and was written as `MPSWritableNode(node=(instance of ...))`. getPresentation() now does what MPS's SNode does: it calls the getPresentation behavior, which reads the name through SNodeAccessUtil and so applies the property getter. The behavior runs on the wrapper instead of the unwrapped SNode, so every read it makes is still dependency tracked and the cell follows changes of the name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nces on wrapped nodes ModelixNodeAsMPSNode left some SNode methods to SNodeBase, which throws, and reduced others to what modelix can resolve: - putUserObject threw and getUserObject always returned null. Behaviors of iets3 and other languages cache data in user objects, and since the presentation of a node is computed by its behavior, they also run on wrapped nodes now. User objects are kept on the MPS node, or on the wrapper for a node of another kind. - setReference with an SNodeReference, a ResolveInfo or an SReference threw. The node reference is stored through modelix. A ResolveInfo that holds a node is set as that node, so that a wrapper never ends up in an MPS node, and the other ones are passed to the MPS node. An SReference is stored as what it points to, because MPS only accepts its own references of the node. - getReference returned null for a reference whose target cannot be resolved, and the target node reference of a reference was computed by resolving it. MPS code finds broken references as ones that exist without a target and writes them with their resolve info, so the reference now exists as long as it points somewhere, says where it points to without resolving, and has the resolve info of the MPS reference. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The link of a super concept is found by its name. The test failed only because of a concept id that doesn't exist, not because of the lookup. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A component can declare parameters and place them with a `slot` cell, and whoever includes it passes a cell for each. This makes wrapper notations possible, and it is how a shared layout gets around the `attributed` cell, which has to stay out of a component: the `@attribute info` is declared on the concrete attribute concept, and an argument keeps the notation it is written in as its ancestor, so every scope sees the concrete concept. Components are now inlined by a pre-processing script instead of a reduction rule, because a reduction under $COPY_SRC$ starts with a new template context and cannot tell which ComponentCell included it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…parameters The wrappers around a single cell (`alias ( … )`, `alias < … >`, `< … >`) are components now, and so are the two pairs of notations that only differ in the links they name, which a component without parameters could not share. The generated notations are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…anguage Every NodeAttribute subconcept of the languages this model covers had a placeholder that was not rendered at all. The notations follow the MPS editors. Attributes that share a layout pass their `attributed` cell to a component as an argument, and the doc comments and imports bring the notations of the concepts inside them. Attributes that nobody adds by typing write their text with a label, because a constant next to the `attributed` cell is offered on every node the attribute can be attached to. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…butes Alt+Enter opens a menu of actions for the selected node, which currently offers the node attributes that are applicable to it. Cells provide the actions through the new contextActions cell property. The menu shares its keyboard handling, filtering and positioning with the code completion menu through the new ActionMenu base class, but has its own look, so the two can't be confused. It opens below the line and leaves the cell text visible. ActionMenuTrigger is a sealed type with one implementation per menu. CodeCompletionMenuUI is folded into ActionMenu. The completion menu now keeps its selection within the filtered entries, and its caret no longer overlaps the last character of the pattern. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The context actions menu (Alt+Enter) now also offers the intentions of the MPS languages, the same ones the intentions menu of MPS shows for the node. They are collected by the IntentionsManager of MPS with a headless editor on the root of the node, which an intention also gets when it is executed, and what it selects there is selected in the web editor afterwards. Context actions come from the new ContextActionsAspect extension point. A headless MPS editor can only be created on the UI thread, so the actions are collected in the ContextActionsAspect.loadingContext, which the MPS integration sets to the UI thread. The menu groups its entries like the intentions menu of MPS-extensions: the actions without a group first, then a heading per group. The section of an intention is taken from its description the same way. The actions for adding node attributes have a group of their own. Instead of a description, an entry shows an icon, which for an intention is the one MPS shows for its kind. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ntext actions menu The context actions menu now also offers the quick fixes of the messages the editor shows, like the intentions menu of MPS does. The background model checker keeps the MPS report items of its last completed check, and the headless editor the intentions are collected with highlights those of the node and its ancestors. MPS then decides which quick fixes apply. The checker checks wrappers of the nodes, so the quick fixes it reports hold these wrappers in their arguments. A quick fix like AddCast moves such an argument into the model, which would put a wrapper into the MPS model. The arguments are replaced by the MPS nodes they wrap before a quick fix is offered. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ble part of the editor The entries of the context actions menu were limited to a height of 200px, which showed only about 9 of the many intentions the MPS languages offer. The menu now uses the space down to the end of the visible part of the editor, and opens above its anchor if the entries don't fit below it but there is more space above, like the popups of MPS. The JS editor measures the visible part as the window cut down by the scrolling elements around the editor. Where it can't be measured, the entries are limited to 60% of the window height. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The constraint that hides the concepts of languages a model doesn't use never
applied. It looked for the MPSModelAsNode of the model among the ancestors of
the node, but the ancestors come as legacy nodes that wrap it. So the code
completion offered the concepts of every language in the repository: the
closures, collections and smodel concepts competed with baseLanguage in a
plain Java model, and made typing `{` or `f` ambiguous.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…editor
Typing baseLanguage code key by key, as in a text editor, now ends up as the
code that was typed. All of it is derived from the notations, none of it is
declared for baseLanguage:
- After a completion created nodes around what was typed, the caret goes to
the first slot that still needs input: `int abc` is a declaration of abc,
not an `int` cell with the text `intabc`.
- A completion is applied automatically only if no longer one can still be
typed: `do` isn't the do-while loop as long as it can become a `double`.
- A key that starts a new token applies the only match of the text before it
and is typed again behind it, as in `x=x+1`. If several match, the one
whose next child can start with that key is applied: `(1` is a
parenthesized expression, because a type can't start with `1`.
- Typing a constant that is already there moves the caret over it, so `if (`,
`x)`, `{` and the `:` of a ternary don't end up as text that means nothing.
- Spaces where nothing can hold them are dropped.
- Side transforms don't apply to text that is still being typed, or that is
still the text of a substitution, like the `1.` of `1.5`. A side transform
only wraps a node if everything in front of the typed text is there: `)`
behind `a` doesn't make it `typeof(a)`.
- The same action is offered once, without wrappers where none are needed,
and a concept wins over its sub-concepts that are written the same way.
- New nodes get their mandatory children that leave no choice, like the
body of an `if`, as MPS does.
- A side transform menu whose text is deleted again closes, and one that
matches nothing anymore applies what was typed before a space: `else {`.
- Deleting undoes typing: deleting in the empty operand of `a + <>` gives
`a`, `!<>` and `return <>` are removed, an empty slot in an optional part
of the notation removes that part, a node whose last character is deleted
leaves its empty slot, and a property without text is unset.
- Typing a different operator over the one of a node turns it into the
concept whose notation only differs in that constant, keeping the
operands: `a + b` becomes `a - b`.
BaseLanguageTypingTest covers these gestures. The existing tests pressed TAB
after typing a type to get to the name, where the caret now already is.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Typing an operator behind a node that is the last operand of other operators can wrap each of them: `+` behind the `2` of `1 * 2` can make `1 * (2 + <>)` or `(1 * 2) + <>`. The innermost node was always wrapped, so `1*2+3` became `1 * (2 + 3)` while the editor showed `1 * 2 + 3`. A notation can now declare the precedence of an operator. The side transform that is typed takes the whole of each operator around the node that binds tighter, and operators of the same level are grouped from the left unless they are right associative. Without precedences, nothing changes. - The editor DSL has `precedence(level, rightAssociative)` on the root of a notation. - The notation language has an optional `precedence:` expression and a `right associative` flag on concept notations, in the inspector. Inside the expression, `concept` is the concept the notation is applied to, which a notation for all sub-concepts needs. - The baseLanguage notations of the operators declare it from baseLanguage's own `getPrecedenceLevel()`, so the precedences are the ones MPS uses. Assignments and the ternary operator are right associative. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ModelixNodeAsMPSNode.getContainmentLink() resolved the role against the concept of the parent and returned null unless that gave an MPSChildLink. Where the concept resolves to a generated modelix concept, the link is a generated one, so a node with a parent had no containment link. MPS code relies on the two being null together: - Scope.parent goes from a node into its last node attribute, and from an attribute up to the parent of the attributed node only if it sees the attribute in the smodelAttribute role. Without a role it went back to the attributed node and around again, so the background model checker looped forever in CheckVariableDoubling on a variable with a SuppressErrorsAnnotation or a doc comment, holding the read lock and freezing MPS. - SNodeOperations.getAllSiblings asserts the role, which failed in check_BaseDocCommentDuplication on a ClassifierDocComment. The role of an MPS node already is the id of its MPS link, so the link is now taken from it before anything is resolved. A role that can't be turned into an MPS link becomes an InvalidContainmentLink with its name, as MPS uses for a role the concept doesn't declare, which is enough for the code that only compares roles. The ConstraintsChecker of MPS only checks "can be child" when the link of a child is one of its parent concept's, so it now runs on wrapped nodes too. For the operations of a DotExpression it reports errors that MPS itself doesn't, which this doesn't fix. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… the editor A solution in the MPS project, outside every publication, whose classes exercise the recent editor changes in the web editor. Comments in the code say what to type or press and what to expect: - TypingPlayground: lines to type key by key, things to delete, and operators to type over. - OperatorPrecedence: operators to type behind the last operand of another one, and expressions that must show no parentheses the model doesn't have. - ContextActions: nodes with MPS intentions for Alt+Enter, in a class long enough for the menu to open above a node. - QuickFixes: type errors that MPS offers quick fixes for. - NodeAttributes: doc comments, an annotation and a SuppressErrorsAnnotation. The model uses only baseLanguage and javadoc (plus lang.text for the comments), so the completion offers nothing else. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…S uses MPS generates `link == link/DotExpression : operation/` in a constraint as a comparison with `==`, and keeps one instance per link in MetaAdapterFactory, which its nodes return. ModelixNodeAsMPSNode created a new link adapter on each call, equal but not the same, so the "can be child" rule of IOperation failed: the web editor reported "FieldReferenceOperation cannot be child of DotExpression" for every operation that has no rule of its own, which MPS doesn't. An MPS link is now the instance MetaAdapterFactory keeps for its id. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The editor asks for the messages of the nodes it shows, and they are checked a moment later. A node deleted in between, like a statement replaced while typing, was checked as a root node: getRootNode stops at a node without a parent, and an MPS node without a parent reports the role of a root node. MPS's ConstraintsChecker then checks it as a root of its model, which it doesn't have: IllegalArgumentException: Argument for @NotNull parameter 'model' of CanBeRootContext.<init> must not be null The node also stayed among the checked roots for good, because MPSWritableNode.isValid() is always true (fixed in modelix.core#3105). A root node is now also required to have a parent, its model, so getRootNodeOrNull returns null for a node that isn't part of a model, as it says it does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The sandbox holds code with type errors on purpose, for the quick fixes in the context actions menu, and javac fails on them. Its model is now marked "do not generate", so a make of the project skips it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
maven.pkg.jetbrains.space doesn't resolve anymore, and an unreachable repository fails a resolution instead of being skipped: the CI builds stopped at the local MPS of the IntelliJ Platform Gradle Plugin, which Gradle looks for in every repository. kotlinx-html is on Maven Central. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Node attributes (
jetbrains.mps.lang.core.structure.NodeAttribute) are now rendered and editable in the projectional editor.attributedcell (AttributedCellTemplate, DSLattributed { attributedConcept(...); multiple(...) }).CellCreationCall(AttributedNodeCellCreationCall). Theattributedcell works out the next layer inward from the model alone (the attribute's parent and the next attribute after it), the way a child cell would.ChildSpecReferencenow holds aCellCreationCall, so adding or removing an attribute only rebuilds the layers next to it.attributedcell is not rendered, so it can't hide the node, and its check messages stay on the attributed node.attributed node:line.smodelAttributeas a child role.attributedin front of a node adds the attribute; typing the first constant after it behind the node does the same.multiplefrom@attribute infoare respected.AttributedCellconcept with behavior, acanBeChildconstraint (node-attribute notations only), an editor and a generator rule that reads@attribute info.ReviewMigrationin thejetbrains.mps.lang.corenotation now uses it (@Review(reason)above the node).Separate fix in the first commit
updateCodeCompletionActionsrebuilt the menu entries from the anchor cell's substitute actions. When the menu had been opened as a side transform, this dropped all of its entries on the second keystroke, so no side transform longer than one character could be completed by typing it. It now reuses the menu that was opened, ashasCodeCompletionActionsalready did. This affects all multi-character side transforms, not only attributes.Notes for reviewers
IConceptEditorRegistrygainedgetAllConceptEditors(), implemented inLanguageAspectsFromMPSModules; the editor uses it to find attribute notations.allChildrenrather than thesmodelAttributelink, because a model may store that role by name or by ID, and reading it one way registers an incremental dependency that misses changes stored the other way.CodeCompletionTest's list of known duplicates lost its<smodelAttribute>tokens because of the reflective-editor change.Tests
NodeAttributeTest(kernelf, 14 tests): rendering and nesting order, both fallbacks, adding by typing before, after, nested and key by key, themultipleand concept restrictions, and delete to remove.BaseLanguageTests(MPS-backed):@Reviewrenders above a method, typing it adds it, deleting it removes it. All 31 tests in that module pass.projectional-editorandkernelf-editorpass; the JS targets compile; the headless MPS build (:mps:assembleMpsModules) generates and compiles the notation modules.🤖 Generated with Claude Code