@Internal
  public static @Nls @Nullable String generateFileDoc(@NotNull PsiFileSystemItem psiFile, boolean withUrl) {
    VirtualFile fileOrArchiveRoot = PsiUtilCore.getVirtualFile(psiFile);
    VirtualFile file;
    if (psiFile instanceof PsiDirectory) {
      if (fileOrArchiveRoot != null && fileOrArchiveRoot.getFileSystem() instanceof ArchiveFileSystem fileSystem
          && fileOrArchiveRoot.equals(fileSystem.getRootByEntry(fileOrArchiveRoot))) {
        file = fileSystem.getLocalByEntry(fileOrArchiveRoot);
      }
      else {
        //we don't show meaningful information for real directories
        return null;
      }
    }
    else {
      file = fileOrArchiveRoot;
    }
    File ioFile = file == null || !file.isInLocalFileSystem() ? null : VfsUtilCore.virtualToIoFile(file);
    BasicFileAttributes attr = null;
    try {
      attr = ioFile == null ? null : Files.readAttributes(Paths.get(ioFile.toURI()), BasicFileAttributes.class);
    }
    catch (Exception ignored) {
    }
    if (attr == null) return null;
    FileType type = file.getFileType();
    @Nls String typeName = type.getDisplayName();
    @Nls String languageName = type.isBinary() ? "" : psiFile.getLanguage().getDisplayName();
    var content = List.of(
      getVcsStatus(psiFile.getProject(), file),
      getScope(psiFile.getProject(), fileOrArchiveRoot),
      HtmlChunk.p().children(
        GRAYED_ELEMENT.addText(CodeInsightBundle.message("documentation.file.size.label")),
        HtmlChunk.nbsp(),
        HtmlChunk.text(StringUtil.formatFileSize(attr.size()))
      ),
      HtmlChunk.p().children(
        GRAYED_ELEMENT.addText(CodeInsightBundle.message("documentation.file.type.label")),
        HtmlChunk.nbsp(),
        HtmlChunk.text(typeName + (type.isBinary() || typeName.equals(languageName) ? "" : " (" + languageName + ")"))
      ),
      HtmlChunk.p().children(
        GRAYED_ELEMENT.addText(CodeInsightBundle.message("documentation.file.modification.datetime.label")),
        HtmlChunk.nbsp(),
        HtmlChunk.text(DateFormatUtil.formatDateTime(attr.lastModifiedTime().toMillis()))
      ),
      HtmlChunk.p().children(
        GRAYED_ELEMENT.addText(CodeInsightBundle.message("documentation.file.creation.datetime.label")),
        HtmlChunk.nbsp(),
        HtmlChunk.text(DateFormatUtil.formatDateTime(attr.creationTime().toMillis()))
      )
    );
    var result = !withUrl
                 ? List.of(CONTENT_ELEMENT.children(content))
                 : List.of(
                   HtmlChunk.text(file.getPresentableUrl()).wrapWith(PRE_ELEMENT).wrapWith(DEFINITION_ELEMENT),
                   CONTENT_ELEMENT.children(content)
                 );
    @Nls StringBuilder sb = new StringBuilder();
    for (HtmlChunk chunk : result) {
      chunk.appendTo(sb);
    }
    return sb.toString();
  }
@Internal
  public static @Nls @Nullable String generateFileDoc(@NotNull PsiFileSystemItem psiFile, boolean withUrl)