if preceding token cannot be found - scan from the beginning of enclosing node

This commit is contained in:
Vladimir Matveev
2014-11-11 13:25:54 -08:00
parent 31763a31d3
commit f53254b538

View File

@@ -238,7 +238,8 @@ module ts.formatting {
}
var precedingToken = findPrecedingToken(enclosingNode.pos, sourceFile);
return precedingToken ? precedingToken.end : originalRange.pos;
// no preceding token found - start from the beginning of enclosing node
return precedingToken ? precedingToken.end : enclosingNode.pos;
}
function formatSpan(originalRange: TextRange,