Add support for the "..." entry in read_only_files (#64222)

## Objective

Let projects add read-only file patterns without repeating the patterns
inherited from user settings.

## Solution

Extend the `"..."` behavior introduced in #62769 to `read_only_files`. A
`"..."` entry includes the inherited patterns. Omitting it replaces the
list, and `[]` clears it.

## Testing

Tested on macOS with settings merge, VS Code import, and project
integration tests. The project test verifies that user and project
patterns both apply while unrelated files remain editable.

To check manually, configure different user and project patterns,
include `"..."` in the project list, and open matching files. Repeat
without `"..."` after restarting Zed to verify replacement.

Linux, Windows, and manual app testing were not performed.

## 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 `read_only_files` so project settings can
extend inherited read-only patterns.

---------

Co-authored-by: Kirill Bulatov <kirill@zed.dev>
This commit is contained in:
Dom PoradaandKirill Bulatov authored and GitHub committed 2026-09-15 11:49:56 +00:00
1 parent cb2190f461
commit 593d6a4d66
6 files changed
+243 -28

No files matched your search

+18
View File
@@ -3790,6 +3790,24 @@ Examples:
List of `string` glob patterns
## Read-Only Files {#read-only-files}
- Default: `[]`
- Description: Glob patterns for files you can open and view but cannot edit, such as generated files or external dependencies.
- Setting: `read_only_files`
Add this to your project’s `.zed/settings.json`:
```json [settings]
{
"read_only_files": ["**/generated/**", "..."]
}
```
Like [File Scan Exclusions](#file-scan-exclusions), `"..."` expands to the list inherited from the preceding settings layer. This example adds generated files to the read-only patterns from your user settings without repeating them. Duplicate entries collapse to their first occurrence.
Omit `"..."` to replace the inherited list, or use `[]` to clear it. These patterns apply when you open a file.
## Read SSH Config
- Description: Whether to read SSH configuration files