reuse utility code to resolve CSS import references; improve the previous fix by... appcode/146.847 clion/146.846
authorSergey Simonchik <sergey.simonchik@jetbrains.com>
Fri, 25 Mar 2016 11:52:55 +0000 (14:52 +0300)
committerSergey Simonchik <sergey.simonchik@jetbrains.com>
Fri, 25 Mar 2016 11:53:26 +0000 (14:53 +0300)
platform/lang-impl/src/com/intellij/psi/impl/include/FileIncludeManagerImpl.java

index 98e327097cf2fcfde960f2c3ee4f2feb25b64673..a79e85e91f4d87eafae6dd042f069e74bf0647d1 100644 (file)
@@ -30,7 +30,6 @@ import com.intellij.psi.PsiFileFactory;
 import com.intellij.psi.PsiFileSystemItem;
 import com.intellij.psi.PsiManager;
 import com.intellij.psi.impl.source.PsiFileImpl;
-import com.intellij.psi.impl.source.resolve.reference.impl.providers.FileReferenceHelper;
 import com.intellij.psi.impl.source.resolve.reference.impl.providers.FileReferenceSet;
 import com.intellij.psi.search.GlobalSearchScope;
 import com.intellij.psi.util.CachedValueProvider;
@@ -182,35 +181,9 @@ public class FileIncludeManagerImpl extends FileIncludeManager {
       protected boolean useIncludingFileAsContext() {
         return false;
       }
-
-      @NotNull
-      @Override
-      public Collection<PsiFileSystemItem> computeDefaultContexts() {
-        Collection<PsiFileSystemItem> contexts = super.computeDefaultContexts();
-        if (!isAbsolutePathReference()) {
-          return addFileDirectoryToContexts(contexts, context);
-        }
-        return contexts;
-      }
     }.resolve();
   }
 
-  @NotNull
-  private static Collection<PsiFileSystemItem> addFileDirectoryToContexts(@NotNull Collection<PsiFileSystemItem> contexts,
-                                                                          @NotNull PsiFile context) {
-    VirtualFile file = context.getOriginalFile().getVirtualFile();
-    VirtualFile dir = file == null ? null : file.getParent();
-    if (dir != null) {
-      PsiFileSystemItem item = FileReferenceHelper.getPsiFileSystemItem(context.getManager(), dir);
-      if (item != null && !contexts.contains(item)) {
-        List<PsiFileSystemItem> result = ContainerUtil.newArrayList(contexts);
-        result.add(item);
-        return result;
-      }
-    }
-    return contexts;
-  }
-
   private abstract class IncludeCacheHolder {
 
     private final Key<ParameterizedCachedValue<VirtualFile[], PsiFile>> COMPILE_TIME_KEY;