lib/commands/wrap-with-abbreviation.js
function getTagRangeForPos(editor, pos) {
	const model = editor.getEmmetDocumentModel();
	const tag = model && model.nodeForPoint(pos);

	if (!tag) {
		return null;
	}

	// Depending on given position, return either outer or inner tag range
	if (inRange(tag.open, pos) || inRange(tag.close, pos)) {
		// Outer range
		return rangeFromNode(tag);
	}

	// Inner range
	const from = tag.open.end;
	const to = tag.close ? tag.close.start : tag.open.end;

	return narrowToNonSpace(editor, from, to);
}
function getTagRangeForPos(editor, pos) {
	const model = editor.getEmmetDocumentModel();
	const tag = model && model.nodeForPoint(pos);

	if (!tag) {
		return null;
	}

	// Depending on given position, return either outer or inner tag range
	if (inRange(tag.open, pos) || inRange(tag.close, pos)) {
		// Outer range
		return rangeFromNode(tag);
	}

	// Inner range
	const from = tag.open.end;
	const to = tag.close ? tag.close.start : tag.open.end;

	return narrowToNonSpace(editor, from, to);
}
Returns either inner or outer tag range (depending on `pos` location)
for given position
@param {CodeMirror} editor
@param {Object} pos
@return {Object}