e.edit((editBuilder) =>{//here e is an object of texteditor
editBuilder.insert(_p, content);
return true;
},
{undoStopAfter : true ,undoStopBefore : false}
).then(x=>{
// what will happen after specifying undoStopAfter and undoStopBefore options?
return true;
});
They specify if an "undo stop" should be inserted before and after the document change (in this case an edit) is executed. An "undo stop" is like a checkpoint you access when using ctrl+z/ctrl+y. If both are set to false
, then the edit will practically be part of the previous edit in the otherwise inaccessible history stack that vscode uses.
See my question and answer here for an example of a use-case.
By default it seems like edit
adds an "undo stop" before an edit (undoStopAfter : true
), but it is ambiguous if it adds one after an edit.