mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
don't reparse whole file if text hasn't changed
inspired by IDEA-CR-24858
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user