How to properly create undoable actions/intentions with root nodes?

I've been trying to figure this out for a while now, and have come up empty. Perhaps it's a bug. Perhaps I'm missing something.

I want to create a new root node from an intention, very similar to how IDEA can create a new Java class from an unrecognized text reference name.

E.g. editor:

   Name: html Alias: html Subtags: head

Here, I have my cursor on the reference cell containing the text "head", which is a non-existent tag type. I want my intention to create a new TagTypeDeclaration node in the current model, with the name supplied as "head".

I have got the intention working to create the TagTypeDeclaration as desired, but when I test it and try to do Ctrl-Z to see if it supports undo, it does not undo the intention.

I've tested other kinds of changes in my intention, such as adding a new non-root node, and these are undo-able. But the root node creation still can't be undone in the same way.

I looked all through the MPS source, and tried different things, including surrounding the root node creation with a 'command', using ModelAccess methods, wrapping it up in an action, etc.

What am I missing? Is this a bug?
1 comment
Comment actions Permalink
Looks like a bug. You can file a YouTrack request for it.

Please sign in to leave a comment.