don't reparse whole file if text hasn't changed

inspired by IDEA-CR-24858
This commit is contained in:
peter
2017-10-04 13:00:12 +02:00
parent c68b4c11f4
commit 6ea05ce72e
@@ -848,8 +848,9 @@ public class DocumentCommitThread implements Runnable, Disposable, DocumentCommi
oldDocumentText.charAt(prefix) == newDocumentText.charAt(prefix)) { prefix++; }
while (suffix < shortestLength - prefix &&
oldDocumentText.charAt(psiLength - suffix - 1) == newDocumentText.charAt(newDocumentText.length() - suffix - 1)) { suffix++; }
TextRange changedPsiRange = TextRange.create(prefix, Math.max(prefix, psiLength - suffix));
return changedPsiRange;
int length = Math.max(prefix, psiLength - suffix);
if (length == 0 && newDocumentText.length() == oldDocumentText.length()) return null;
return TextRange.create(prefix, length);
}
public static void doActualPsiChange(@NotNull final PsiFile file, @NotNull final DiffLog diffLog) {