cancel snippet mode before starting again from the API, #19449

This commit is contained in:
Johannes Rieken
2017-01-31 10:44:01 +01:00
parent 64d1439ba2
commit 20a6724331

View File

@@ -403,17 +403,21 @@ export class MainThreadTextEditor {
return false;
}
const snippetController = SnippetController.get(this._codeEditor);
// cancel previous snippet mode
snippetController.leaveSnippet();
// set selection, focus editor
const selections = ranges.map(r => new Selection(r.startLineNumber, r.startColumn, r.endLineNumber, r.endColumn));
this._codeEditor.setSelections(selections);
this._codeEditor.focus();
// make modifications
if (opts.undoStopBefore) {
this._codeEditor.pushUndoStop();
}
const snippetController = SnippetController.get(this._codeEditor);
snippetController.insertSnippet(template, 0, 0);
if (opts.undoStopAfter) {
this._codeEditor.pushUndoStop();
}