When should we use UndoUtil.markPsiFileForUndo()?

Looking at various quick fixes, I see that some call UndoUtil.markPsiFileForUndo(), but others do not. So far, I can't see any clear pattern for which fixes call that method, nor have I found any documentation explaining when to call it. Given that it clearly is not essential in all situations, under what circumstances are we supposed to call UndoUtil.markPsiFileForUndo()?

1 comment

JavaDoc says 'make undoable action in current document in order to Undo action work from current file'.

Usually undo is available in all affected files plus in the file that the action was initiated from, even if that file was not itself directly affected by the change. In same cases you might want a particular action the be undoable from a specific file (which is not changed, nor was selected in the editor), then you need to mark it using this method


Please sign in to leave a comment.