Add support for the "..." entry in file_scan_inclusions (#64440)

## Objective

Let projects add inclusion patterns without repeating defaults or
patterns inherited from user settings.

Part of #64399.

## Solution

Extend the `"..."` behavior from #62769 and #64222 to
`file_scan_inclusions` using the shared merge implementation. `"..."`
includes the resolved inherited list, omitting it replaces the list, and
`[]` clears it. Duplicate entries retain their first occurrence.

Stop importing VS Code’s `files.watcherInclude` as inclusion patterns
because it configures additional watch roots rather than overriding Git
ignores.

## Testing

Tested on macOS with settings merge, VS Code import, and worktree
integration tests. Coverage includes preservation of the `.env*`
default, layered inheritance, replacement, clearing, and deduplication.
The worktree test verifies that inherited and project-specific patterns
include Git-ignored files while exclusions still take precedence.

To check manually, configure different user and project inclusion
patterns and add ignored files matching each. Include `"..."` to retain
inherited patterns, then repeat without it and with `[]` to verify
replacement and clearing. Confirm that excluded files remain absent.

## Self-Review Checklist:

- [x] I’ve reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content adheres to Zed’s UI standards
([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
and
[icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md)
guidelines)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

---

Release Notes:

- Added support for `"..."` in `file_scan_inclusions` so project
settings can extend inherited inclusion patterns.
This commit is contained in:
Dom Porada authored and GitHub committed 2026-09-18 10:40:43 +00:00
1 parent 18960e899a
commit 2229b4e2d6
8 files changed
+279 -34

No files matched your search

+2 -3
View File
@@ -84,13 +84,12 @@ The following VS Code settings are automatically imported when you use **Import
| VS Code Setting | Zed Setting |
| --------------------------- | ------------------------------ |
| `files.associations` | `file_types` |
| `files.autoSave` | `autosave` |
| `files.autoSaveDelay` | `autosave.milliseconds` |
| `files.insertFinalNewline` | `ensure_final_newline_on_save` |
| `files.associations` | `file_types` |
| `files.watcherExclude` | `file_scan_exclusions` |
| `files.watcherInclude` | `file_scan_inclusions` |
| `files.simpleDialog.enable` | `use_system_path_prompts` |
| `files.watcherExclude` | `file_scan_exclusions` |
| `search.smartCase` | `use_smartcase_search` |
| `search.useIgnoreFiles` | `search.include_ignored` |
+12
View File
@@ -2383,6 +2383,18 @@ The `"..."` entry expands to the list you are overriding, so the example above e
}
```
Use `"..."` to extend the inherited list instead of replacing it. In your user settings, it expands to Zed’s defaults. In a project’s `.zed/settings.json`, it expands to the resolved list from your user settings, including any defaults you kept.
For example, add this to your settings.json to include generated files without repeating inherited patterns:
```json [settings]
{
"file_scan_inclusions": ["...", "generated/**"]
}
```
With the default user settings, this keeps `.env*` and adds `generated/**`. Omit `"..."` to replace the inherited list, or use `[]` to clear it. Duplicate patterns keep their first occurrence, even if `"..."` appears more than once. `file_scan_exclusions` still takes precedence.
## File Scan Depth
- Setting: `file_scan_depth`