diff --git a/platform/lang-impl/src/com/intellij/codeInspection/reference/RefElementImpl.java b/platform/lang-impl/src/com/intellij/codeInspection/reference/RefElementImpl.java index 8097af612960..9071543e5984 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/reference/RefElementImpl.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/reference/RefElementImpl.java @@ -87,6 +87,13 @@ public abstract class RefElementImpl extends RefEntityImpl implements RefElement if (myIsDeleted) return false; return ApplicationManager.getApplication().runReadAction(new Computable() { public Boolean compute() { + + final PsiFile file = myID.getContainingFile(); + //no need to check resolve in offline mode + if (ApplicationManager.getApplication().isHeadlessEnvironment()) { + return file != null && file.isPhysical(); + } + final PsiElement element = getElement(); return element != null && element.isPhysical(); }