diff --git a/platform/diff-impl/src/com/intellij/codeInsight/daemon/OutsidersPsiFileSupport.java b/platform/diff-impl/src/com/intellij/codeInsight/daemon/OutsidersPsiFileSupport.java
index 774965cdba08..33de476b5cff 100644
--- a/platform/diff-impl/src/com/intellij/codeInsight/daemon/OutsidersPsiFileSupport.java
+++ b/platform/diff-impl/src/com/intellij/codeInsight/daemon/OutsidersPsiFileSupport.java
@@ -29,6 +29,14 @@ import com.intellij.psi.PsiFile;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+/**
+ * We want to highlight some files, that do not belong to the project (ex: previous revisions from VCS).
+ * To do so we need some context - SDK, the rest of the project, etc.
+ * We can't get "real" context, but local state is often a good enough approximation.
+ *
+ * This helper is used to disable error highlighting and inspections in such files,
+ * as they tend to be false-positive due to context differences.
+ */
public class OutsidersPsiFileSupport {
public static final Key KEY = Key.create("OutsidersPsiFileSupport");
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/vfs/AbstractVcsVirtualFile.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/vfs/AbstractVcsVirtualFile.java
index a28564df1722..80d89c95778d 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/vfs/AbstractVcsVirtualFile.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/vfs/AbstractVcsVirtualFile.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2014 JetBrains s.r.o.
+ * Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,6 +15,7 @@
*/
package com.intellij.openapi.vcs.vfs;
+import com.intellij.codeInsight.daemon.OutsidersPsiFileSupport;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.vfs.VfsUtilCore;
import com.intellij.openapi.vfs.VirtualFile;
@@ -42,6 +43,8 @@ public abstract class AbstractVcsVirtualFile extends VirtualFile {
myParent = new VcsVirtualFolder(file.getParent(), this, myFileSystem);
else
myParent = null;
+
+ OutsidersPsiFileSupport.markFile(this);
}
@Override