Promise<ExpressionInfo> (@NotNull Project project, @NotNull Document document, int offset, boolean sideEffectsAllowed) { return ReadAction .nonBlocking(() -> { PsiElement elementAtCursor = DebuggerUtilsEx.findElementAt(PsiDocumentManager.getInstance(project).getPsiFile(document), offset); if (elementAtCursor != null && elementAtCursor.isValid()) { EditorTextProvider textProvider = EditorTextProvider.EP.forLanguage(elementAtCursor.getLanguage()); if (textProvider != null) { Pair<PsiElement, TextRange> pair = textProvider.findExpression(elementAtCursor, sideEffectsAllowed); if (pair != null) { PsiElement element = pair.getFirst(); return new ExpressionInfo(pair.getSecond(), null, null, element instanceof PsiExpression ? element : null); } } } return null; }) .inSmartMode(project) .withDocumentsCommitted(project) .submit(AppExecutorUtil.getAppExecutorService()); }