void (@NotNull PsiFile hostFile, @Nullable Editor hostEditor, @NotNull @NlsContexts.Command String commandName, @NotNull ModCommandAction commandAction, int problemOffset) { record ContextAndCommand(@NotNull ActionContext context, @NotNull ModCommand command) { } ThrowableComputable<ContextAndCommand, RuntimeException> computable = () -> ReadAction.nonBlocking(() -> { ActionContext context = chooseContextForAction(hostFile, hostEditor, commandAction); if (context == null) return null; ActionContext adjusted = problemOffset >= 0 ? context.withOffset(problemOffset) : context; return new ContextAndCommand(adjusted, commandAction.perform(adjusted)); }) .expireWhen(() -> hostFile.getProject().isDisposed()) .executeSynchronously(); ContextAndCommand contextAndCommand = ProgressManager.getInstance(). runProcessWithProgressSynchronously(computable, commandName, true, hostFile.getProject()); if (contextAndCommand == null) return; ActionContext context = contextAndCommand.context(); Project project = context.project(); IntentionFUSCollector.record(project, commandAction, context.file().getLanguage()); CommandProcessor.getInstance().executeCommand(project, () -> { ModCommandExecutor.getInstance().executeInteractively(context, contextAndCommand.command(), hostEditor); }, commandName, null); }