@Nullable
  private static VirtualFile getVirtualFile(Object element) {
    if (element instanceof PsiDirectory directory) {
      return directory.getVirtualFile();
    }
    return element instanceof VirtualFile ? (VirtualFile)element : null;
  }
@Nullable
  private static VirtualFile getVirtualFile(Object element)