# util: Embed fs_embed assets with debug-embed \(\#63583\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 2551721adb5b5187bc27cfae0fbe47f0ed4c5397

Requested commit: 2551721adb5b5187bc27cfae0fbe47f0ed4c5397

Commit: 2551721adb5b5187bc27cfae0fbe47f0ed4c5397

Tree: 87e91c6388f99b896616dd17f061c0c864bb41e8

Author: Jakub Konka

Committer: GitHub

## Message

```
util: Embed fs_embed assets with debug-embed (#63583)

Zed's `fs_embed!` macro normally reads assets from the checkout in debug
builds. The new `util/debug-embed` feature is intended to compile those
assets into debug binaries, but it previously changed only the
`rust_embed::Filenames` variant while leaving file loading on the
runtime path.

That breaks downstream workspaces such as Delta: the runtime loader
identifies Delta as the repository root, then looks for Zed grammar
assets under Delta's checkout. Tests consequently panic when language
configuration files cannot be found.

This makes `util/debug-embed` select a compile-time `RustEmbed`
expansion in every profile. Builds without the feature retain live
filesystem loading in debug mode. The runtime iterator no longer depends
on a feature-specific `rust_embed::Filenames` variant, so Cargo feature
unification remains safe when another package enables
`rust-embed/debug-embed` directly. The regression fixture uses a
deliberately invalid runtime path when `debug-embed` is enabled, so it
proves that the embedded path is used rather than passing only because
the Zed checkout contains the test assets.

Testing performed:

- `cargo fmt --all -- --check`
- `cargo nextest run -p util --lib`
- `cargo nextest run -p util --lib --features debug-embed`
- `cargo check -p remote_server --features debug-embed`
- `./script/clippy -p util`
- Delta's previously failing
`tools::edit_file::tests::test_edit_file_rejects_scratch_paths_as_read_only`
against this PR's head commit

Release Notes:

- N/A
```

## Parents

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

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