extensions/emmet/src/toggleComment.ts/toggleCommentStylesheet
function toggleCommentStylesheet(document: vscode.TextDocument, selection: vscode.Selection, rootNode: Stylesheet): vscode.TextEdit[] {
	const selectionStart = selection.isReversed ? selection.active : selection.anchor;
	const selectionEnd = selection.isReversed ? selection.anchor : selection.active;
	let selectionStartOffset = document.offsetAt(selectionStart);
	let selectionEndOffset = document.offsetAt(selectionEnd);

	const startNode = getFlatNode(rootNode, selectionStartOffset, true);
	const endNode = getFlatNode(rootNode, selectionEndOffset, true);

	if (!selection.isEmpty) {
		selectionStartOffset = adjustStartNodeCss(startNode, selectionStartOffset, rootNode);
		selectionEndOffset = adjustEndNodeCss(endNode, selectionEndOffset, rootNode);
		selection = offsetRangeToSelection(document, selectionStartOffset, selectionEndOffset);
	} else if (startNode) {
		selectionStartOffset = startNode.start;
		selectionEndOffset = startNode.end;
		selection = offsetRangeToSelection(document, selectionStartOffset, selectionEndOffset);
	}

	// Uncomment the comments that intersect with the selection.
	const rangesToUnComment: vscode.Range[] = [];
	const edits: vscode.TextEdit[] = [];
	rootNode.comments.forEach(comment => {
		const commentRange = offsetRangeToVsRange(document, comment.start, comment.end);
		if (selection.intersection(commentRange)) {
			rangesToUnComment.push(commentRange);
			edits.push(new vscode.TextEdit(offsetRangeToVsRange(document, comment.start, comment.start + startCommentStylesheet.length), ''));
			edits.push(new vscode.TextEdit(offsetRangeToVsRange(document, comment.end - endCommentStylesheet.length, comment.end), ''));
		}
	});

	if (edits.length > 0) {
		return edits;
	}

	return [
		new vscode.TextEdit(new vscode.Range(selection.start, selection.start), startCommentStylesheet),
		new vscode.TextEdit(new vscode.Range(selection.end, selection.end), endCommentStylesheet)
	];
}