mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
rehighlight the file when document changes resulted in no psi changes
This commit is contained in:
@@ -40,6 +40,7 @@ import com.intellij.psi.impl.PsiDocumentManagerImpl;
|
||||
import com.intellij.psi.impl.PsiDocumentTransactionListener;
|
||||
import com.intellij.psi.impl.PsiTreeChangeEventImpl;
|
||||
import com.intellij.util.SmartList;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.messages.MessageBusConnection;
|
||||
import gnu.trove.THashMap;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -101,7 +102,17 @@ public class PsiChangeHandler extends PsiTreeChangeAdapter implements Disposable
|
||||
private void updateChangesForDocument(@NotNull final Document document) {
|
||||
if (DaemonListeners.isUnderIgnoredAction(null)) return;
|
||||
List<Pair<PsiElement, Boolean>> toUpdate = changedElements.get(document);
|
||||
if (toUpdate == null) return;
|
||||
if (toUpdate == null) {
|
||||
// The document has been changed, but psi hasn't
|
||||
// We may still need to rehighlight the file if there were changes inside highlighted ranges.
|
||||
if (UpdateHighlightersUtil.isWhitespaceOptimizationAllowed(document)) return;
|
||||
|
||||
// don't create PSI for files in other projects
|
||||
PsiElement file = PsiDocumentManager.getInstance(myProject).getCachedPsiFile(document);
|
||||
if (file == null) return;
|
||||
|
||||
toUpdate = ContainerUtil.newArrayList(Pair.create(file, true));
|
||||
}
|
||||
Application application = ApplicationManager.getApplication();
|
||||
final Editor editor = FileEditorManager.getInstance(myProject).getSelectedTextEditor();
|
||||
if (editor != null && !application.isUnitTestMode()) {
|
||||
|
||||
Reference in New Issue
Block a user