You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(vscode): two-tier files.exclude with folder-scoped vault patterns
Split files.exclude management into two tiers to prevent vault patterns
from hiding same-named project entries. Dotfiles and blocked paths go to
ConfigurationTarget.WorkspaceFolder (vault's .vscode/settings.json),
remaining non-autoMount dirs go to ConfigurationTarget.Workspace. The
.vscode entry is never managed by the extension. When the vault is not
yet a workspace folder, all patterns fall back to workspace scope.
Assisted-by: Claude
-**Single `file://` workspace folder at the vault root** for Quick Open (`Cmd+P`) and `Ctrl+Shift+F` search. VSCode's file discovery and ripgrep indexer only operate on `file://` workspace folders — `obs://` workspace folders provide zero discoverability (confirmed by spike, 2026-05-15).
34
-
-**`files.exclude` patterns** hide non-autoMount vault content from Explorer and Quick Open. Patterns are managed via `ConfigurationTarget.Workspace` (routes to `.vscode/settings.json` or `.code-workspace` file automatically). Extension-managed patterns are tracked in `context.workspaceState` and cleaned up on autoMount change or workspace disable.
34
+
-**`files.exclude` patterns** hide non-autoMount vault content. Two-tier split: dotfiles + `blocked` → `ConfigurationTarget.WorkspaceFolder` (`<vault>/.vscode/settings.json`); non-autoMount dirs → `ConfigurationTarget.Workspace`. Tracked in `context.workspaceState`, cleaned up on change or disable.
35
35
-**`obs://` FileSystemProvider** remains registered for TreeView sidebar, wikilinks, drag-and-drop, and watch events — it does not back a workspace folder.
36
36
-**`FileSearchProvider`/`TextSearchProvider` are proposed (unstable) APIs** as of `@types/vscode@1.118.0`. When stabilized, the extension can switch to a single `obs://` workspace folder with native search, eliminating the `files.exclude` workaround. Check `@types/vscode` for stable availability — do not use while proposed.
Copy file name to clipboardExpand all lines: packages/vscode/README.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -65,14 +65,14 @@ Non-autoMount vault content (`.obsidian/`, `.trash/`, and any directories not in
65
65
66
66
**How it works:**
67
67
68
-
- The extension scans the vault root and adds `files.exclude` patterns for entries not in `autoMount`. Patterns are written to workspace settings (`ConfigurationTarget.Workspace`) and tracked internally for cleanup.
68
+
- The extension scans the vault root and adds `files.exclude` patterns for entries not in `autoMount`. Patterns are split into two tiers: vault-global patterns (dotfiles and `blocked` paths from `.obsidian-vfs.json`) are written to `<vault>/.vscode/settings.json`; remaining non-autoMount directories are written to workspace settings. All managed patterns are tracked internally for cleanup.
69
69
- When `autoMount` entries change, patterns are re-synced automatically — stale patterns are removed and new ones added.
70
70
- When `obsidianVFS.workspace` is disabled, all managed patterns are removed and the workspace folder is deleted.
71
71
- The vault's `.git` repository is automatically added to `git.ignoredRepositories` (user-level setting) when the workspace folder is mounted, preventing VS Code's Git extension from listing it in Source Control. The entry is removed when `obsidianVFS.workspace` is disabled.
72
72
73
73
**Known limitations:**
74
74
75
-
-**Pattern scope:**`files.exclude` patterns apply to all workspace folders. If a non-autoMount vaultdirectory shares a name with a directory in your project (e.g., both have a `docs/` folder), the project directory will also be hidden. Fix: add the vault directory to `autoMount`, or rename it in your vault.
75
+
-**Vault `.vscode/` directory:**The extension creates `.vscode/settings.json` inside the vault for vault-global `files.exclude` patterns (dotfiles and `blocked` paths). These patterns are independent of `autoMount` and apply to any workspace that includes the vault. The `.vscode/`directory itself is never managed by the extension — if you want to hide it, add `.vscode` to your own `files.exclude`. When `obsidianVFS.workspace` is disabled, all managed patterns are removed from both folder and workspace settings. If your vault is git-tracked, consider adding `.vscode/` to the vault's `.gitignore`.
76
76
-**Not a security boundary:**`files.exclude` hides content from Explorer and Quick Open but does not enforce access restrictions. The `obs://` FileSystemProvider's path security (`allowed`/`blocked` lists in `.obsidian-vfs.json`) applies to TreeView, wikilink, and drag-and-drop operations.
77
77
-**Title bar:** Adding the vault as a workspace folder creates a multi-root workspace. VS Code may show "UNTITLED (WORKSPACE)" in the title bar.
78
78
@@ -92,15 +92,15 @@ Enable `obsidianVFS.workspaceFile` to fix this. The extension generates a `<proj
92
92
1. The extension creates `<project-name>.code-workspace` in your project root containing the local folder(s) and the `file://` vault folder entry (named `obs://<VaultName>`).
93
93
2. A notification asks: _"Open workspace file? This will reload the window."_
94
94
3. If you click **Open**, the window reloads once. After that, the title bar shows the project name and the vault is part of the saved workspace.
95
-
4. On subsequent activations, the extension detects you're already in a saved workspace and skips the prompt. `files.exclude` patterns are written to the `.code-workspace` file's `settings` section (via `ConfigurationTarget.Workspace`) instead of `.vscode/settings.json`.
96
-
5. If you click **Not Now**, the extension falls back to adding the vault dynamically via `updateWorkspaceFolders` (with `files.exclude` patterns in `.vscode/settings.json`). You can open the generated workspace file later.
95
+
4. On subsequent activations, the extension detects you're already in a saved workspace and skips the prompt. Vault-global `files.exclude` patterns (dotfiles and `blocked` paths) are written to `<vault>/.vscode/settings.json`; workspace-specific patterns (non-autoMount directories) are written to workspace settings (routed to the `.code-workspace` file when one is active, or to the project's `.vscode/settings.json` otherwise).
96
+
5. If you click **Not Now**, the extension falls back to adding the vault dynamically via `updateWorkspaceFolders` (with `files.exclude` patterns in the vault's `.vscode/settings.json`). You can open the generated workspace file later.
97
97
98
98
**UX trade-offs:**
99
99
100
100
-**One-time window reload** — opening the workspace file causes VS Code to reload the window. This only happens once; after that the workspace file is saved and reloads are not needed.
101
101
-**File on disk** — a `.code-workspace` file is created in your project root. You can commit it to version control (so teammates get the same workspace layout) or add it to `.gitignore`.
102
102
-**No overwrite** — if a `.code-workspace` file already exists (e.g., from a previous run or your own), the extension will not overwrite it. It offers to open the existing file instead.
103
-
-**`files.exclude` containment** — with a `.code-workspace` file, `files.exclude` patterns are scoped to the workspace file rather than `.vscode/settings.json`. This reduces the risk of pattern collisions with project directories (see Known limitations above).
103
+
-**`files.exclude` containment** — vault-global patterns (dotfiles and `blocked` paths) are scoped to the vault workspace folder, preventing vault dotfiles (`.git`, `.obsidian`) from hiding same-named entries in your project. Workspace-specific patterns (non-autoMount directories like `00-inbox`, `40-log`) use workspace settings and are unlikely to collide with project entries.
0 commit comments