@@ -62,8 +62,16 @@ export class ResourceEditStackSnapshot {
6262export interface IUndoRedoService {
6363 readonly _serviceBrand : undefined ;
6464
65+ /**
66+ * Register an URI -> string hasher.
67+ * This is useful for making multiple URIs share the same undo-redo stack.
68+ */
6569 registerUriComparisonKeyComputer ( uriComparisonKeyComputer : UriComparisonKeyComputer ) : IDisposable ;
6670
71+ /**
72+ * Get the hash used internally for a certain URI.
73+ * This uses any registered `UriComparisonKeyComputer`.
74+ */
6775 getUriComparisonKey ( resource : URI ) : string ;
6876
6977 /**
@@ -73,22 +81,34 @@ export interface IUndoRedoService {
7381 pushElement ( element : IUndoRedoElement ) : void ;
7482
7583 /**
76- * Get the last pushed element. If the last pushed element has been undone, returns null.
84+ * Get the last pushed element for a resource.
85+ * If the last pushed element has been undone, returns null.
7786 */
7887 getLastElement ( resource : URI ) : IUndoRedoElement | null ;
7988
89+ /**
90+ * Get all the elements associated with a resource.
91+ * This includes the past and the future.
92+ */
8093 getElements ( resource : URI ) : IPastFutureElements ;
8194
82- hasElements ( resource : URI ) : boolean ;
83-
95+ /**
96+ * Validate or invalidate stack elements associated with a resource.
97+ */
8498 setElementsValidFlag ( resource : URI , isValid : boolean , filter : ( element : IUndoRedoElement ) => boolean ) : void ;
8599
86100 /**
87101 * Remove elements that target `resource`.
88102 */
89103 removeElements ( resource : URI ) : void ;
90104
105+ /**
106+ * Create a snapshot of the current elements on the undo-redo stack for a resource.
107+ */
91108 createSnapshot ( resource : URI ) : ResourceEditStackSnapshot ;
109+ /**
110+ * Attempt (as best as possible) to restore a certain snapshot previously created with `createSnapshot` for a resource.
111+ */
92112 restoreSnapshot ( snapshot : ResourceEditStackSnapshot ) : void ;
93113
94114 canUndo ( resource : URI ) : boolean ;
0 commit comments