Skip to content

Setting: filter file tree by extension allowlist #116

@spamsch

Description

@spamsch

Problem

The current fileTreeContentMode setting is a binary — either notes_only (markdown + PDF + HTML) or all_files. There's no way to say "show markdown, PDF, and CSV but not everything else." Power users with mixed vaults want finer control over what shows up in the tree.

Proposed setting

Add a fileTreeExtensionFilter: string[] setting — an ordered list of extensions that should be visible. An empty array means no filter (show everything, consistent with the current all_files behaviour). Extensions stored without the leading dot: ["md", "pdf", "txt"].

High-level implementation plan

1. Settings interface (settingsStore.ts)
Add fileTreeExtensionFilter: string[] to the Settings interface alongside the existing fileTreeContentMode and fileTreeShowExtensions fields.

2. Default + normalization (settingsStore.ts)
Default to [] (no filter). In the normalization pass, ensure the value is an array of non-empty strings and strip any leading dots so input like .md and md both work.

3. Filtering logic (FileTree.tsx, visibleEntries memo ~line 1790)
After the existing fileTreeContentMode check, apply the extension filter when the list is non-empty:

if (fileTreeExtensionFilter.length > 0 && entry.extension) {
  return fileTreeExtensionFilter.includes(entry.extension.toLowerCase());
}

Folders are always shown regardless (same as today).

4. Settings UI (Developer or Navigation section in the settings panel)
A tag/chip input where users type an extension and press Enter to add it, with an ✕ to remove each one. Show a placeholder like pdf, txt, csv … when empty. Sits below the existing "Show file extensions" toggle.

Out of scope

  • Glob or regex patterns (keep it simple for now)
  • Per-folder overrides
  • Hiding folders based on extension rules

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions