let find in path uses Trigram & IdIndex in dumb mode as is (IDEA-225580): follow IDEA-CR-54769

GitOrigin-RevId: a86db80bcc9817826f035f44c0d1eef29f86d964
This commit is contained in:
Dmitry Batkovich
2019-11-13 11:35:50 +00:00
committed by intellij-monorepo-bot
parent 490dd8b2ac
commit ca5a323d7c
5 changed files with 10 additions and 7 deletions
@@ -116,6 +116,6 @@ public class DefaultClassNavigationContributor implements ChooseByNameContributo
@Override
public boolean isDumbAware() {
return FileBasedIndex.indexAccessDuringDumbModeEnabled();
return FileBasedIndex.isIndexAccessDuringDumbModeEnabled();
}
}
@@ -220,7 +220,7 @@ public abstract class FileBasedIndex {
public static final boolean ourSnapshotMappingsEnabled = SystemProperties.getBooleanProperty("idea.index.snapshot.mappings.enabled", true);
@ApiStatus.Internal
public static boolean indexAccessDuringDumbModeEnabled() {
public static boolean isIndexAccessDuringDumbModeEnabled() {
return ApplicationManager.getApplication().isInternal() && !ourDisableIndexAccessDuringDumbMode;
}
private static final boolean ourDisableIndexAccessDuringDumbMode = SystemProperties.getBooleanProperty("idea.disable.index.access.during.dumb.mode", false);
@@ -1057,10 +1057,10 @@ public class PsiSearchHelperImpl implements PsiSearchHelper {
() -> FileBasedIndex.getInstance().processFilesContainingAllKeys(IdIndex.NAME, keys, scope, checker, processor);
Boolean[] result = {null};
if (FileBasedIndex.indexAccessDuringDumbModeEnabled()) {
ReadAction.run(() -> {
if (FileBasedIndex.isIndexAccessDuringDumbModeEnabled()) {
ReadAction.nonBlocking(() -> {
FileBasedIndex.getInstance().ignoreDumbMode(() -> result[0] = query.compute(), project);
});
}).executeSynchronously();
}
return result[0] != null ? result[0] : DumbService.getInstance(project).runReadActionInSmartMode(query);
}
@@ -401,7 +401,7 @@ class FindInProjectTask {
private Set<VirtualFile> getFilesForFastWordSearch() {
String stringToFind = myStringToFindInIndices;
if (stringToFind.isEmpty() || (DumbService.getInstance(myProject).isDumb() && !FileBasedIndex.indexAccessDuringDumbModeEnabled())) {
if (stringToFind.isEmpty() || (DumbService.getInstance(myProject).isDumb() && !FileBasedIndex.isIndexAccessDuringDumbModeEnabled())) {
return Collections.emptySet();
}
@@ -1193,7 +1193,10 @@ public final class FileBasedIndexImpl extends FileBasedIndex {
@Override
public void ignoreDumbMode(@NotNull Runnable runnable, @NotNull Project project) {
assert ApplicationManager.getApplication().isReadAccessAllowed();
if (DumbService.isDumb(project) && FileBasedIndex.indexAccessDuringDumbModeEnabled()) {
if (FileBasedIndex.isIndexAccessDuringDumbModeEnabled()) {
if (ourDumbModeIgnored.get() != null) {
throw new AssertionError("Nested index access in dumb mode");
}
ourDumbModeIgnored.set(Boolean.TRUE);
try {
runnable.run();