Promise<Object> (@NotNull PlaybackContext context) { ActionCallback actionCallback = new ActionCallbackProfilerStopper(); String extractCommandList = extractCommandArgument(PREFIX); String[] commandList = extractCommandList.split("\\|"); final String actionName = commandList[0]; final boolean invoke = commandList.length == 1 || Boolean.parseBoolean(commandList[1]); ApplicationManager.getApplication().invokeAndWait(Context.current().wrap(() -> { @NotNull Project project = context.getProject(); Editor editor = FileEditorManager.getInstance(project).getSelectedTextEditor(); if (editor != null) { PsiFile psiFile = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument()); if (psiFile != null) { TraceUtil.runWithSpanThrows(PerformanceTestSpan.TRACER, SPAN_NAME, span -> { CachedIntentions intentions = ShowIntentionActionsHandler.calcCachedIntentions(project, editor, psiFile); if (!actionName.isEmpty()) { List<IntentionActionWithTextCaching> combined = new ArrayList<>(); combined.addAll(intentions.getIntentions()); combined.addAll(intentions.getInspectionFixes()); combined.addAll(intentions.getErrorFixes()); //combined.addAll(intentions.guttersToShow); combined.addAll(intentions.getNotifications()); span.setAttribute("number", combined.size()); Optional<IntentionActionWithTextCaching> singleIntention = combined.stream().filter(s -> s.getAction().getText().startsWith(actionName)).findFirst(); if (singleIntention.isEmpty()) { actionCallback.reject(actionName + " is not found among " + combined); return; } if (invoke) { singleIntention.ifPresent( c -> ShowIntentionActionsHandler.chooseActionAndInvoke(psiFile, editor, c.getAction(), c.getAction().getText())); } } if (!invoke || actionName.isEmpty()) { IntentionHintComponent.showIntentionHint(project, psiFile, editor, true, intentions); } }); if(!actionCallback.isRejected()){ actionCallback.setDone(); } } else { actionCallback.reject("PSI File is null"); } } else { actionCallback.reject("Editor is not opened"); } })); return Promises.toPromise(actionCallback); }