lib/actions/toggle-block-comment.js
function uncomment(editor, range, modelType) {
	const commentParts = modelComments[modelType];
	const stream = new BufferStreamReader(editor.getBuffer(), range.start, range);

	// narrow down comment range till meanful content
	stream.pos = range.start.translate([0, commentParts.before.length]);
	stream.eatWhile(isSpace);
	stream.start = stream.pos;

	// Make sure comment ends with proper token
	stream.pos = range.end.translate([0, -commentParts.after.length]);
	if (editor.getTextInBufferRange([stream.pos, range.end]) === commentParts.after) {
		while (!stream.sof()) {
			if (!isSpace(stream.backUp(1))) {
				stream.next();
				break;
			}
		}
	} else {
		stream.pos = range.end;
	}

	const start = new Range(range.start, stream.start);
	const end = new Range(stream.pos, range.end);
	const delta = {
		start: editor.getTextInBufferRange(start).length,
		end: editor.getTextInBufferRange(end).length
	};

	editor.setTextInBufferRange(end, '');
	editor.setTextInBufferRange(start, '');

	return delta;
}
function uncomment(editor, range, modelType) {
	const commentParts = modelComments[modelType];
	const stream = new BufferStreamReader(editor.getBuffer(), range.start, range);

	// narrow down comment range till meanful content
	stream.pos = range.start.translate([0, commentParts.before.length]);
	stream.eatWhile(isSpace);
	stream.start = stream.pos;

	// Make sure comment ends with proper token
	stream.pos = range.end.translate([0, -commentParts.after.length]);
	if (editor.getTextInBufferRange([stream.pos, range.end]) === commentParts.after) {
		while (!stream.sof()) {
			if (!isSpace(stream.backUp(1))) {
				stream.next();
				break;
			}
		}
	} else {
		stream.pos = range.end;
	}

	const start = new Range(range.start, stream.start);
	const end = new Range(stream.pos, range.end);
	const delta = {
		start: editor.getTextInBufferRange(start).length,
		end: editor.getTextInBufferRange(end).length
	};

	editor.setTextInBufferRange(end, '');
	editor.setTextInBufferRange(start, '');

	return delta;
}
function uncomment ( editor , range , modelType ) { const commentParts = modelComments [ modelType ] ; const stream = new BufferStreamReader ( editor . getBuffer ( ) , range . start , range ) ; // narrow down comment range till meanful content stream . pos = range . start . translate ( [ 0 , commentParts . before . length ] ) ; stream . eatWhile ( isSpace ) ; stream . start = stream . pos ; // Make sure comment ends with proper token stream . pos = range . end . translate ( [ 0 , - commentParts . after . length ] ) ; if ( editor . getTextInBufferRange ( [ stream . pos , range . end ] ) === commentParts . after ) { while ( ! stream . sof ( ) ) { if ( ! isSpace ( stream . backUp ( 1 ) ) ) { stream . next ( ) ; break ; } } } else { stream . pos = range . end ; } const start = new Range ( range . start , stream . start ) ; const end = new Range ( stream . pos , range . end ) ; const delta = { start : editor . getTextInBufferRange ( start ) . length , end : editor . getTextInBufferRange ( end ) . length } ; editor . setTextInBufferRange ( end , '' ) ; editor . setTextInBufferRange ( start , '' ) ; return delta ; }
Un-comments given range in text editor
@param  {TextEditor} editor
@param  {Range}      range
@param  {String}     modelType
@return {Object}     Returns delta of removed characters from
Un - comments given range in text editor