# Support external \`\.editorconfig\` \(\#46332\) · gitcafe/zed

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

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

Visibility: public

Requested revision: dcfe81f8cc056785e59c2d1f39e91de19177c879

Requested commit: dcfe81f8cc056785e59c2d1f39e91de19177c879

Commit: dcfe81f8cc056785e59c2d1f39e91de19177c879

Tree: b3b4d99a5f8b8e76dce5ed04aa1e10212c12abea

Author: Smit Barmase

Committer: GitHub

## Message

```
Support external `.editorconfig` (#46332)

Closes #41832

Extends https://github.com/zed-industries/zed/pull/19455

When an internal `.editorconfig` is detected in the worktree, we
traverse parent directories up to the filesystem root looking for
additional `.editorconfig` files. All discovered external configs are
loaded and cached (shared when multiple worktrees reference the same
parent directories). When computing settings for a file, external
configs are applied first (from furthest to closest), then internal
configs.

For local projects, file watchers are set up for each external config so
changes are applied immediately. When a project is shared via collab,
external configs are sent to guests through the existing
`UpdateWorktreeSettings` proto message (with a new `outside_worktree`
field). SSH remoting works similarly.

Limitations: We don't currently take creation of new external editor
config files into account since they are loaded once on worktree add.

Release Notes:

- Added support for `.editorconfig` files outside the project directory.
Zed now traverses parent directories to find and apply EditorConfig
settings. Use `root = true` in any `.editorconfig` to stop inheriting
settings from parent directories.
```

## Parents

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

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