lib/actions/select-item.js
function getPreviousItemRange(model, anchor, getItemRanges) {
	// Find HTML node for next selection
	let node = nodeForPoint(model, anchor.start, 'previous');
	let range;

	// We might need to narrow down node context to find best token match
	while (node) {
		range = getPreviousRange(getItemRanges(node), anchor);
		if (range) {
			break;
		}
		node = previousSibling(node) || node.parent;
	}

	return range;
}
function getPreviousItemRange(model, anchor, getItemRanges) {
	// Find HTML node for next selection
	let node = nodeForPoint(model, anchor.start, 'previous');
	let range;

	// We might need to narrow down node context to find best token match
	while (node) {
		range = getPreviousRange(getItemRanges(node), anchor);
		if (range) {
			break;
		}
		node = previousSibling(node) || node.parent;
	}

	return range;
}
function getPreviousItemRange ( model , anchor , getItemRanges ) { // Find HTML node for next selection let node = nodeForPoint ( model , anchor . start , 'previous' ) ; let range ; // We might need to narrow down node context to find best token match while ( node ) { range = getPreviousRange ( getItemRanges ( node ) , anchor ) ; if ( range ) { break ; } node = previousSibling ( node ) || node . parent ; } return range ; }
Returns selection range of useful code part of given `model` that precedes
given `anchor` range.
@param  {SyntaxModel} model
@param  {Range}       anchor
@param  {Function}    getItemRanges A function to retreive node ranges
@return {Range}
Returns selection range of useful code part of given model that precedes given anchor range .