extensions/emmet/src/splitJoinTag.ts/getRangesToReplace
function getRangesToReplace(document: vscode.TextDocument, nodeToUpdate: HtmlFlatNode): vscode.TextEdit {
	let rangeToReplace: vscode.Range;
	let textToReplaceWith: string;

	if (!nodeToUpdate.open || !nodeToUpdate.close) {
		// Split Tag
		const nodeText = document.getText().substring(nodeToUpdate.start, nodeToUpdate.end);
		const m = nodeText.match(/(\s*\/)?>$/);
		const end = nodeToUpdate.end;
		const start = m ? end - m[0].length : end;

		rangeToReplace = offsetRangeToVsRange(document, start, end);
		textToReplaceWith = `></${nodeToUpdate.name}>`;
	} else {
		// Join Tag
		const start = nodeToUpdate.open.end - 1;
		const end = nodeToUpdate.end;
		rangeToReplace = offsetRangeToVsRange(document, start, end);
		textToReplaceWith = '/>';

		const emmetMode = getEmmetMode(document.languageId, []) || '';
		const emmetConfig = getEmmetConfiguration(emmetMode);
		if (emmetMode && emmetConfig.syntaxProfiles[emmetMode] &&
			(emmetConfig.syntaxProfiles[emmetMode]['selfClosingStyle'] === 'xhtml' || emmetConfig.syntaxProfiles[emmetMode]['self_closing_tag'] === 'xhtml')) {
			textToReplaceWith = ' ' + textToReplaceWith;
		}
	}

	return new vscode.TextEdit(rangeToReplace, textToReplaceWith);
}