fix: ignore certains files and folders from the file tree
- Created new config file for ignored paths in file system traversal - Separated ignored folders and files into dedicated arrays - Includes comprehensive ignore patterns for: - Package managers (node_modules, venv) - Build outputs and caches - Version control - IDE specific folders - Framework specific directories - System and config files - Lock files and compiled assets
This commit is contained in:
@ -10,6 +10,8 @@ import {
|
||||
import { Input } from "@/components/ui/input"
|
||||
import { ContextTab } from "./types"
|
||||
import { ContextTabsProps } from "./types"
|
||||
// Ignore certain folders and files from the file tree
|
||||
import { ignoredFiles, ignoredFolders } from "./lib/ignored-paths"
|
||||
|
||||
export default function ContextTabs({
|
||||
contextTabs,
|
||||
@ -48,9 +50,13 @@ export default function ContextTabs({
|
||||
// Get all files from the file tree to search for context
|
||||
const getAllFiles = (items: (TFile | TFolder)[]): TFile[] => {
|
||||
return items.reduce((acc: TFile[], item) => {
|
||||
if (item.type === "file") {
|
||||
// Add file if it's not ignored
|
||||
if (item.type === "file" && !ignoredFiles.some((pattern: string) =>
|
||||
item.name.endsWith(pattern.replace('*', '')) || item.name === pattern
|
||||
)) {
|
||||
acc.push(item)
|
||||
} else {
|
||||
// Add all files from folder if it's not ignored
|
||||
} else if (item.type === "folder" && !ignoredFolders.some((folder: string) => folder === item.name)) {
|
||||
acc.push(...getAllFiles(item.children))
|
||||
}
|
||||
return acc
|
||||
|
Reference in New Issue
Block a user