From 32d50033470311e8a32c9be0085249ec47b4ea8b Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Tue, 26 May 2015 17:34:54 +0300 Subject: [PATCH] ignore excluded files modifications during highlighting --- .../codeInsight/daemon/impl/PsiChangeHandler.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/PsiChangeHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/PsiChangeHandler.java index c198ead746f4..2c0f5f218c9a 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/PsiChangeHandler.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/PsiChangeHandler.java @@ -32,6 +32,7 @@ import com.intellij.openapi.extensions.Extensions; import com.intellij.openapi.fileEditor.FileEditorManager; import com.intellij.openapi.project.Project; import com.intellij.openapi.project.ProjectCoreUtil; +import com.intellij.openapi.roots.ProjectRootManager; import com.intellij.openapi.util.Key; import com.intellij.openapi.util.Pair; import com.intellij.openapi.util.TextRange; @@ -189,7 +190,7 @@ class PsiChangeHandler extends PsiTreeChangeAdapter implements Disposable { String propertyName = event.getPropertyName(); if (!propertyName.equals(PsiTreeChangeEvent.PROP_WRITABLE)) { Object oldValue = event.getOldValue(); - if (oldValue instanceof VirtualFile && ProjectCoreUtil.isProjectOrWorkspaceFile((VirtualFile)oldValue)) { + if (oldValue instanceof VirtualFile && shouldBeIgnored((VirtualFile)oldValue)) { // ignore workspace.xml return; } @@ -231,7 +232,7 @@ class PsiChangeHandler extends PsiTreeChangeAdapter implements Disposable { return; } VirtualFile virtualFile = file.getVirtualFile(); - if (virtualFile != null && ProjectCoreUtil.isProjectOrWorkspaceFile(virtualFile)) { + if (virtualFile != null && shouldBeIgnored(virtualFile)) { // ignore workspace.xml return; } @@ -259,6 +260,11 @@ class PsiChangeHandler extends PsiTreeChangeAdapter implements Disposable { } } + private boolean shouldBeIgnored(@NotNull VirtualFile virtualFile) { + return ProjectCoreUtil.isProjectOrWorkspaceFile(virtualFile) || + ProjectRootManager.getInstance(myProject).getFileIndex().isExcluded(virtualFile); + } + @Nullable private static PsiElement getChangeHighlightingScope(@NotNull PsiElement element) { DefaultChangeLocalityDetector defaultDetector = null;