import { shouldIgnoreInCommandPalette } from "../constants/ignored-patterns";
import { getBaseName, normalizePath } from "@/utils/path-helpers";

/**
 * Check if a file should be ignored in Quick Open
 * @param filePath - The full file path
 * @returns true if the file should be ignored
 */
export const shouldIgnoreFile = (filePath: string): boolean => {
  const fileName = getBaseName(filePath, "");

  // Check if any directory in the path should be ignored
  const pathParts = normalizePath(filePath).split("/");
  for (const part of pathParts) {
    if (shouldIgnoreInCommandPalette(part, true)) {
      return true;
    }
  }

  // Check the filename itself
  return shouldIgnoreInCommandPalette(fileName, false);
};
