# Import VS Code \`files.exclude\` into \`file_scan_exclusions\` \(\#64492\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/8d085f19283dd62f432b72101e6cf9c20878a1b5)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 8d085f19283dd62f432b72101e6cf9c20878a1b5

Requested commit: 8d085f19283dd62f432b72101e6cf9c20878a1b5

Commit: 8d085f19283dd62f432b72101e6cf9c20878a1b5

Tree: c13898aa6061f36217dbe967f5688774147bb46c

Author: Dom Porada

Committer: GitHub

## Message

```
Import VS Code `files.exclude` into `file_scan_exclusions` (#64492)

## Objective

Import VS Code’s `files.exclude` into `file_scan_exclusions`.

The previous `files.watcherExclude` mapping was dead code: it expected
an array, while VS Code stores an object of `pattern: bool`.
`files.watcherExclude` only stops watching, and the files stay visible
in VS Code, so it is not a match for `file_scan_exclusions`.
`files.exclude` hides files from the explorer and search, which matches
`file_scan_exclusions`, and its default set is nearly identical to
Zed's.

Related to #62769, reported during the review of #64484. A meta
follow-up to #64399.

## Solution

Import nonempty `files.exclude` patterns enabled with `true`, ignoring
disabled and malformed entries, including VS Code's `{"when": ...}`
form.
Append `"..."` so the imported list extends inherited exclusions instead
of replacing them.
Inputs with no usable patterns leave the inherited list unchanged.
`files.watcherExclude` is no longer imported.

## Testing

The new regression tests reproduce the bug and verify the fix.

To check manually, import
`{"files.exclude":{"**/build/**":true,"**/cache/**":false}}` and verify
that `file_scan_exclusions` becomes `["**/build/**", "..."]`, and that
`.git` stays hidden in the project panel.

## 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:

- Fixed importing VS Code `files.exclude` into `file_scan_exclusions`.

---------

Co-authored-by: Kirill Bulatov <kirill@zed.dev>
```

## Parents

- [887149bbdd90a2f376583f156e558f2f016dc2e8](https://git.cafe/gitcafe/zed/commit/887149bbdd90a2f376583f156e558f2f016dc2e8?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/8d085f19283dd62f432b72101e6cf9c20878a1b5?format=markdown)
