Skip to content

Commit 75cf1be

Browse files
committed
JSDoc improvements
1 parent db5c0a2 commit 75cf1be

1 file changed

Lines changed: 23 additions & 3 deletions

File tree

src/vs/platform/undoRedo/common/undoRedo.ts

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,16 @@ export class ResourceEditStackSnapshot {
6262
export 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

Comments
 (0)