Don't call into the incremental parser for now.

Return a tree if the textChangeRange is empty.
This commit is contained in:
Cyrus Najmabadi 2014-12-10 13:19:01 -08:00
parent 26927b4ba2
commit f400e5955a
2 changed files with 9 additions and 4 deletions

View File

@ -1180,12 +1180,16 @@ module ts {
}
function update(newText: string, textChangeRange: TextChangeRange) {
if (textChangeRange.isUnchanged()) {
// if the text didn't change, then we can just return our current source file as-is.
return sourceFile;
}
// Don't pass along the text change range for now. We'll pass it along once incremental
// parsing is enabled.
return parseSourceFile(newText, /*textChangeRange:*/ undefined, /*setNodeParents*/ true);
}
function setContextFlag(val: Boolean, flag: ParserContextFlags) {
if (val) {
contextFlags |= flag;

View File

@ -1711,9 +1711,10 @@ module ts {
// incrementally parse this file.
if (textChangeRange) {
if (version !== sourceFile.version || isOpen != sourceFile.isOpen) {
var newSourceFile = sourceFile.update(scriptSnapshot.getText(0, scriptSnapshot.getLength()), textChangeRange);
setSourceFileFields(newSourceFile, scriptSnapshot, version, isOpen);
return newSourceFile;
// Once incremental parsing is ready, then just call into this function.
// var newSourceFile = sourceFile.update(scriptSnapshot.getText(0, scriptSnapshot.getLength()), textChangeRange);
// setSourceFileFields(newSourceFile, scriptSnapshot, version, isOpen);
// return newSourceFile;
}
}