mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-16 15:44:16 -06:00
Don't call into the incremental parser for now.
Return a tree if the textChangeRange is empty.
This commit is contained in:
parent
26927b4ba2
commit
f400e5955a
@ -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;
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user