mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-24 10:38:59 +01:00
cancel snippet mode before starting again from the API, #19449
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user