Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Find a file
tims b1375ab946
project_panel: Fix crash when adding a new file or directory to the first folded directory (#23217)
Closes #23216

This crash happens in the `update_visible_entries` function, where we
calculate `ancestors` and `current_ancestor_depth`. `ancestors` is map
storing information about folded ancestors and `current_ancestor_depth`
is basically selected ancestor index in reverse order of visibility.

For example, before adding a new file or directory in `a/b/c`, the
`ancestors` might look like:

```jsonc
{
    "entry_id_of_c": {
            "current_ancestor_depth": 2,  // "a" is selected
            "ancestors": ["entry_id_of_a", "entry_id_of_b", "entry_id_of_c"]
    }
}
```

When new file or directory is added to`a`, ancestors length is reduced,
as `a` now is not part of folded dir due to having multiple children.

But depth still remains the same as while calculating it, we use depth
from `old_ancestors` to preserve selection across renders. This causes
panic.

```jsonc
{
    "entry_id_of_c": {
            "current_ancestor_depth": 2,  // wrong: use of old depth here causes panic
            "ancestors": ["entry_id_of_b", "entry_id_of_c"]  // correct: notice "a" is missing, as "a" now has multiple children
    }
}
```

This PR fixes it by capping depth so it don't exceed `ancestors` array.
This preserves existing depth as well as handles our edge case.

Release Notes:

- Fixed crash when adding a new file or directory to the first folded
directory
2025-01-16 23:34:44 -07:00
.cargo Fix configuration issue in CI runners (#23223) 2025-01-16 21:01:47 +08:00
.cloudflare
.config
.github Make docs-only PRs skip CI.yml test suite (15 secs instead of 15 minutes) (#23246) 2025-01-16 12:09:54 -05:00
.zed
assets vim: ! support (#23169) 2025-01-16 21:19:15 -07:00
crates project_panel: Fix crash when adding a new file or directory to the first folded directory (#23217) 2025-01-16 23:34:44 -07:00
docs docs: Add Shell Script language documentation (#23248) 2025-01-16 12:16:38 -05:00
extensions csharp: Add brackets.scm (#22936) 2025-01-10 16:18:33 +00:00
legal
nix nix: Fix webrtc-sys and libstdc++ build errors in development shell (#22938) 2025-01-10 12:50:33 +00:00
script Add mold dependency to fix build on Ubuntu 24.10 (#23230) 2025-01-16 13:43:47 -05:00
tooling/xtask
.git-blame-ignore-revs
.gitattributes
.gitignore
.mailmap
Cargo.lock vim: ! support (#23169) 2025-01-16 21:19:15 -07:00
Cargo.toml Add streaming_diff crate (#23264) 2025-01-16 23:12:46 +00:00
clippy.toml
CODE_OF_CONDUCT.md
compose.yml
CONTRIBUTING.md
Cross.toml
debug.plist
default.nix
docker-compose.sql
Dockerfile-collab
Dockerfile-collab.dockerignore
Dockerfile-cross
Dockerfile-cross.dockerignore
Dockerfile-distros
Dockerfile-distros.dockerignore
flake.lock Fix nix shell (#22091) 2025-01-07 04:03:22 +00:00
flake.nix
LICENSE-AGPL
LICENSE-APACHE
LICENSE-GPL
livekit.yaml
Procfile
Procfile.postgrest
README.md
renovate.json
rust-toolchain.toml
shell.nix
typos.toml clojure: Extract to zed-extensions/clojure repository (#22628) 2025-01-03 21:14:53 +00:00

Zed

CI

Welcome to Zed, a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.


Installation

Packaging status

On macOS and Linux you can download Zed directly or install Zed via your local package manager.

Other platforms are not yet available:

Developing Zed

Contributing

See CONTRIBUTING.md for ways you can contribute to Zed.

Also... we're hiring! Check out our jobs page for open roles.

Licensing

License information for third party dependencies must be correctly provided for CI to pass.

We use cargo-about to automatically comply with open source licenses. If CI is failing, check the following:

  • Is it showing a no license specified error for a crate you've created? If so, add publish = false under [package] in your crate's Cargo.toml.
  • Is the error failed to satisfy license requirements for a dependency? If so, first determine what license the project has and whether this system is sufficient to comply with this license's requirements. If you're unsure, ask a lawyer. Once you've verified that this system is acceptable add the license's SPDX identifier to the accepted array in script/licenses/zed-licenses.toml.
  • Is cargo-about unable to find the license for a dependency? If so, add a clarification field at the end of script/licenses/zed-licenses.toml, as specified in the cargo-about book.