don't load VirtualFile content twice during Find Usages

there's no need to cache it in VFS, since it's already indexed and cached

GitOrigin-RevId: f61dbf62b26b681741992c35ff9c069b9540c501
This commit is contained in:
peter
2019-05-03 03:24:54 +03:00
committed by intellij-monorepo-bot
parent 7be10a9d70
commit eca0346bec
@@ -11,7 +11,6 @@ import com.intellij.openapi.application.ex.ApplicationEx;
import com.intellij.openapi.application.ex.ApplicationUtil;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.openapi.fileEditor.FileDocumentManager;
import com.intellij.openapi.progress.*;
import com.intellij.openapi.progress.impl.CoreProgressManager;
import com.intellij.openapi.progress.util.TooManyUsagesStatus;
@@ -44,7 +43,6 @@ import gnu.trove.THashSet;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.io.IOException;
import java.util.*;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
@@ -396,15 +394,6 @@ public class PsiSearchHelperImpl implements PsiSearchHelper {
@NotNull final AtomicBoolean stopped) throws ApplicationUtil.CannotRunReadActionException {
final PsiFile file = ApplicationUtil.tryRunReadAction(() -> vfile.isValid() ? myManager.findFile(vfile) : null);
if (file != null && !(file instanceof PsiBinaryFile)) {
// load contents outside read action
if (FileDocumentManager.getInstance().getCachedDocument(vfile) == null) {
// cache bytes in vfs
try {
vfile.contentsToByteArray();
}
catch (IOException ignored) {
}
}
ApplicationUtil.tryRunReadAction(() -> {
final Project project = myManager.getProject();
if (project.isDisposed()) throw new ProcessCanceledException();