Merge from vscode 1ce89e2cb720d69c496c2815c4696ee4fd4429a6 (#6779)

* Merge from vscode 1ce89e2cb720d69c496c2815c4696ee4fd4429a6

* redisable accounts because of issues
This commit is contained in:
Anthony Dresser
2019-08-15 23:56:46 -07:00
committed by GitHub
parent fb4e3c6a05
commit 6f297efb88
166 changed files with 1941 additions and 1279 deletions

View File

@@ -489,21 +489,18 @@ export class SnippetSession {
return;
}
const model = this._editor.getModel();
// make insert edit and start with first selections
const { edits, snippets } = SnippetSession.createEditsAndSnippets(this._editor, this._template, this._options.overwriteBefore, this._options.overwriteAfter, false, this._options.adjustWhitespace, this._options.clipboardText);
this._snippets = snippets;
const selections = model.pushEditOperations(this._editor.getSelections(), edits, undoEdits => {
this._editor.executeEdits('snippet', edits, undoEdits => {
if (this._snippets[0].hasPlaceholder) {
return this._move(true);
} else {
return undoEdits.map(edit => Selection.fromPositions(edit.range.getEndPosition()));
}
})!;
this._editor.setSelections(selections);
this._editor.revealRange(selections[0]);
});
this._editor.revealRange(this._editor.getSelections()[0]);
}
merge(template: string, options: ISnippetSessionInsertOptions = _defaultOptions): void {
@@ -513,8 +510,7 @@ export class SnippetSession {
this._templateMerges.push([this._snippets[0]._nestingLevel, this._snippets[0]._placeholderGroupsIdx, template]);
const { edits, snippets } = SnippetSession.createEditsAndSnippets(this._editor, template, options.overwriteBefore, options.overwriteAfter, true, options.adjustWhitespace, options.clipboardText);
this._editor.setSelections(this._editor.getModel().pushEditOperations(this._editor.getSelections(), edits, undoEdits => {
this._editor.executeEdits('snippet', edits, undoEdits => {
for (const snippet of this._snippets) {
snippet.merge(snippets);
}
@@ -525,7 +521,7 @@ export class SnippetSession {
} else {
return undoEdits.map(edit => Selection.fromPositions(edit.range.getEndPosition()));
}
})!);
});
}
next(): void {