From 84cbc404f479a1e084261e10a6647a700b68dc0c Mon Sep 17 00:00:00 2001 From: Tagir Valeev Date: Wed, 13 Nov 2019 18:23:08 +0700 Subject: [PATCH] DfaAssist: use non-blocking read action with committed documents GitOrigin-RevId: d39f35b0d0c21a65170880566daeba2127088825 --- .../com/intellij/debugger/engine/dfaassist/DfaAssist.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/dfaassist/DfaAssist.java b/java/debugger/impl/src/com/intellij/debugger/engine/dfaassist/DfaAssist.java index 9c18d706e798..d7eb1ae6bc9b 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/dfaassist/DfaAssist.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/dfaassist/DfaAssist.java @@ -24,6 +24,7 @@ import com.intellij.openapi.editor.Inlay; import com.intellij.openapi.editor.InlayModel; import com.intellij.openapi.editor.impl.EditorImpl; import com.intellij.openapi.fileEditor.FileEditorManager; +import com.intellij.openapi.project.DumbService; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Disposer; import com.intellij.openapi.util.TextRange; @@ -76,7 +77,8 @@ public class DfaAssist implements DebuggerContextListener { return; } StackFrame frame = proxy.getStackFrame(); - Map hints = ReadAction.compute(() -> computeHints(frame, element)); + Map hints = + ReadAction.nonBlocking(() -> computeHints(frame, element)).withDocumentsCommitted(myProject).executeSynchronously(); displayInlays(hints, sourcePosition); } }); @@ -120,8 +122,8 @@ public class DfaAssist implements DebuggerContextListener { @NotNull static Map computeHints(@NotNull StackFrame frame, @NotNull PsiElement element) { + if (!element.isValid() || DumbService.isDumb(element.getProject())) return Collections.emptyMap(); Method method = frame.location().method(); - if (!element.isValid()) return Collections.emptyMap(); PsiMethod psiMethod = PsiTreeUtil.getParentOfType(element, PsiMethod.class); boolean methodMatches = false;