@Override
  protected boolean setupConfigurationFromContext(@NotNull RestRunConfiguration configuration,
                                                  @NotNull ConfigurationContext context,
                                                  @NotNull Ref<PsiElement> sourceElement) {
    assert (configuration instanceof SphinxRunConfiguration);
    PsiElement element = sourceElement.get();
    if (!(element instanceof PsiDirectory directory)) return false;

    boolean hasRstFile = false;
    boolean hasConf = false;
    for (PsiFile file : directory.getFiles()) {
      if ("conf.py".equals(file.getName())) {
        hasConf = true;
      }
      if (file instanceof RestFile) {
        hasRstFile = true;
      }
    }
    if (!hasRstFile || !hasConf) return false;
    final VirtualFile vFile = directory.getVirtualFile();
    configuration.setInputFile(vFile.getPath());

    configuration.setName(directory.getName());
    if (configuration.getTask().isEmpty()) {
      configuration.setTask("html");
    }
    final VirtualFile parent = vFile.getParent();
    if (parent != null) {
      configuration.setWorkingDirectory(parent.getPath());
    }
    configuration.setName(configuration.suggestedName());
    Module module = ModuleUtilCore.findModuleForPsiElement(element);
    if (module != null) {
      configuration.setUseModuleSdk(true);
      configuration.setModule(module);
    }
    return true;
  }
@Override
  protected boolean setupConfigurationFromContext(@NotNull RestRunConfiguration configuration,
                                                  @NotNull ConfigurationContext context,
                                                  @NotNull Ref<PsiElement> sourceElement)