use textSpanEnd instead of handrolled version

This commit is contained in:
Vladimir Matveev 2015-05-15 16:36:58 -07:00
parent 845820dfe9
commit 1f35f194d2

View File

@ -1835,11 +1835,10 @@ module ts {
? sourceFile.text.substr(0, textChangeRange.span.start)
: "";
let textChangeRangeEnd = textChangeRange.span.start + textChangeRange.span.length;
// grab the fragment from the end of the span till the end of the original text
let suffix = textChangeRangeEnd !== sourceFile.text.length
? sourceFile.text.substr(textChangeRangeEnd)
: "";
let suffix = textSpanEnd(textChangeRange.span) !== sourceFile.text.length
? sourceFile.text.substr(textSpanEnd(textChangeRange.span))
: "";
if (textChangeRange.newLength === 0) {
// edit was a deletion - just combine prefix and suffix