optionally allow to specify selection at which to insert a snippet, #19116

This commit is contained in:
Johannes Rieken
2017-01-25 15:56:02 +01:00
parent bedb191acc
commit a2a077b088
6 changed files with 38 additions and 9 deletions

View File

@@ -397,19 +397,20 @@ export class MainThreadTextEditor {
return false;
}
insertSnippet(template: string, opts: IUndoStopOptions) {
const snippetController = SnippetController.get(this._codeEditor);
insertSnippet(template: string, selections: EditorCommon.ISelection[], opts: IUndoStopOptions) {
if (!this._codeEditor) {
return false;
}
this._codeEditor.focus();
this._codeEditor.setSelections(selections);
if (opts.undoStopBefore) {
this._codeEditor.pushUndoStop();
}
const snippetController = SnippetController.get(this._codeEditor);
snippetController.insertSnippet(template, 0, 0);
if (opts.undoStopAfter) {