Custom folder structure #4
-
How can I customize the folder structure output to ignore certain files or include only specific file extensions using the Folder Structure Pro VS Code extension? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
That's a great question @VardaPanchal005! 😊 🔧 How it works:
🧠 Internals (Simplified):// services/gitignore.ts
const gitignorePath = path.join(dirPath, '.gitignore');
const content = await FileSystemService.readFile(gitignorePath);
const rules = content.split('\n').filter(Boolean);
const ig = ignore().add(rules);
if (ig.ignores(relativePath)) {
continue; // Skip adding this file/folder to output
} This logic is used inside the core method `StructureService.getStructure()`, which builds the entire folder structure recursively while excluding anything ignored. ⚙️ Bonus: Add Custom Ignore Patterns via VS Code SettingsYou can also define ignore patterns directly inside VS Code settings under: Settings → Folder Structure Pro → Ignore Patterns Add glob patterns like: ["*.log", "node_modules", "dist", "build"] The extension merges these settings with ✅ So to customize:
Hope that helps! 💜 |
Beta Was this translation helpful? Give feedback.
That's a great question @VardaPanchal005! 😊
Here’s how I’ve handled it in the extension 👇
The extension uses a custom
GitignoreService
internally to support ignoring files and folders — just like a.gitignore
file does!🔧 How it works:
.gitignore
from the selected root directorynode_modules
,*.log
, etc.)ignore
package.🧠 Internals (Simplified):