catch IndexNotReadyException in IdentifierHighlighterPass, don't highlight anything in that case

This commit is contained in:
Dmitry Jemerov
2014-12-29 16:55:00 +01:00
parent 3faec8152d
commit 840b66255a
@@ -33,6 +33,7 @@ import com.intellij.openapi.editor.impl.DocumentMarkupModel;
import com.intellij.openapi.editor.markup.MarkupModel;
import com.intellij.openapi.editor.markup.RangeHighlighter;
import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.project.IndexNotReadyException;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Couple;
import com.intellij.openapi.util.Pair;
@@ -85,7 +86,13 @@ public class IdentifierHighlighterPass extends TextEditorHighlightingPass {
}
int flags = TargetElementUtilBase.ELEMENT_NAME_ACCEPTED | TargetElementUtilBase.REFERENCED_ELEMENT_ACCEPTED;
PsiElement myTarget = TargetElementUtilBase.getInstance().findTargetElement(myEditor, flags, myCaretOffset);
PsiElement myTarget;
try {
myTarget = TargetElementUtilBase.getInstance().findTargetElement(myEditor, flags, myCaretOffset);
}
catch (IndexNotReadyException e) {
return;
}
if (myTarget == null) {
if (!PsiDocumentManager.getInstance(myProject).isUncommited(myEditor.getDocument())) {