mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
directory scopes shouldn't assume they're always inside project (IDEA-181135)
This commit is contained in:
@@ -248,7 +248,7 @@ public class GlobalSearchScopesCore {
|
||||
|
||||
@Override
|
||||
public boolean isSearchInLibraries() {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -346,7 +346,7 @@ public class GlobalSearchScopesCore {
|
||||
|
||||
@Override
|
||||
public boolean isSearchInLibraries() {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.intellij.psi.search;
|
||||
import com.intellij.openapi.roots.ModuleRootModificationUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.testFramework.PlatformTestCase;
|
||||
import com.intellij.testFramework.PsiTestUtil;
|
||||
import com.intellij.testFramework.TempFiles;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -107,4 +108,16 @@ public class GlobalSearchScopeTest extends PlatformTestCase {
|
||||
assertFalse(GlobalSearchScope.fileScope(myProject, file1).intersectWith(trueIntersection).contains(file2));
|
||||
assertEquals(1, targetCalled.get());
|
||||
}
|
||||
|
||||
public void testDirScopeSearchInLibraries() throws IOException {
|
||||
VirtualFile libRoot = getVirtualFile(createTempDir("libRoot"));
|
||||
VirtualFile contentRoot = getVirtualFile(createTempDir("contentRoot"));
|
||||
|
||||
PsiTestUtil.removeAllRoots(getModule(), null);
|
||||
PsiTestUtil.addContentRoot(getModule(), contentRoot);
|
||||
PsiTestUtil.addLibrary(getModule(), libRoot.getPath());
|
||||
|
||||
assertTrue(GlobalSearchScopes.directoryScope(myProject, libRoot, true).isSearchInLibraries());
|
||||
assertTrue(GlobalSearchScopes.directoriesScope(myProject, true, libRoot, contentRoot).isSearchInLibraries());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user