src/vs/editor/contrib/snippet/browser/snippetSession.ts/SnippetSession/merge
class SnippetSession:	merge(template: string, options: ISnippetSessionInsertOptions = _defaultOptions): void {
		if (!this._editor.hasModel()) {
			return;
		}
		this._templateMerges.push([this._snippets[0]._nestingLevel, this._snippets[0]._placeholderGroupsIdx, template]);
		const { edits, snippets } = SnippetSession.createEditsAndSnippetsFromSelections(this._editor, template, options.overwriteBefore, options.overwriteAfter, true, options.adjustWhitespace, options.clipboardText, options.overtypingCapturer, this._languageConfigurationService);

		this._editor.executeEdits('snippet', edits, _undoEdits => {
			// Sometimes, the text buffer will remove automatic whitespace when doing any edits,
			// so we need to look only at the undo edits relevant for us.
			// Our edits have an identifier set so that's how we can distinguish them
			const undoEdits = _undoEdits.filter(edit => !!edit.identifier);
			for (let idx = 0; idx < snippets.length; idx++) {
				snippets[idx].initialize(undoEdits[idx].textChange);
			}

			// Trivial snippets have no placeholder or are just the final placeholder. That means they
			// are just text insertions and we don't need to merge the nested snippet into the existing
			// snippet
			const isTrivialSnippet = snippets[0].isTrivialSnippet;
			if (!isTrivialSnippet) {
				for (const snippet of this._snippets) {
					snippet.merge(snippets);
				}
				console.assert(snippets.length === 0);
			}

			if (this._snippets[0].hasPlaceholder && !isTrivialSnippet) {
				return this._move(undefined);
			} else {
				return undoEdits.map(edit => Selection.fromPositions(edit.range.getEndPosition()));
			}
		});
	}