IDEA-177314 Call parsing procedure from EDT
authorAlexey Utkin <alexey.utkin@jetbrains.com>
Wed, 9 Aug 2017 08:30:09 +0000 (11:30 +0300)
committerAlexey Utkin <alexey.utkin@jetbrains.com>
Wed, 9 Aug 2017 08:30:09 +0000 (11:30 +0300)
platform/lang-impl/src/com/intellij/codeInsight/highlighting/BraceHighlightingHandler.java

index e0f69e7534053b0a51bcea736d91f8145333cbd5..8a1ee21cb46b7aa3133b713ff7a8d1954d91cdfb 100644 (file)
@@ -112,10 +112,11 @@ public class BraceHighlightingHandler {
     }
     final int offset = editor.getCaretModel().getOffset();
     final Project project = editor.getProject();
-    final PsiFile psiFile = PsiUtilBase.getPsiFileInEditor(editor, project);
-    if (!isValidFile(psiFile)) return;
     ApplicationManager.getApplication().executeOnPooledThread(() -> {
       if (!ApplicationManagerEx.getApplicationEx().tryRunReadAction(() -> {
+        final PsiFile psiFile = PsiUtilBase.getPsiFileInEditor(editor, project);
+        if (!isValidFile(psiFile)) return;
+
         final PsiFile injected;
         try {
           if (psiFile instanceof PsiBinaryFile || !isValidEditor(editor) || !isValidFile(psiFile)) {