mirror of
https://github.com/zed-industries/zed.git
synced 2026-05-24 05:25:18 +00:00
Follow up on: https://github.com/zed-industries/zed/pull/49519 This PR reworks how Zed calculates diff num stats by moving the calculation to the `RepositorySnapshot` layer, instead of the `GitPanel`. This has a couple of benefits: 1. Snapshot recalculations are already set up to recompute on file system changes and only update the affected files. This means that diff stats don't need to manage their own subscription or states anymore like they did in the original PR. 2. We're able to further separate the data layer from the UI. Before, the git panel owned all the subscriptions and tasks that refreshed the diff stat, now the repository does, which is more inline with the code base. 3. Integration tests are cleaner because `FakeRepository` can handle all the data and calculations of diff stat and make it accessible to more tests in the codebase. Because a lot of tests wouldn't initialize the git panel when they used the git repository. 4. This made implementing remote/collab support for this feature streamline. Remote clients wouldn't get the same buffer events as local clients, so they wouldn't know that the diff stat state has been updated and invalidate their data. 5. File system changes that happened outside of Zed now trigger the diff stat refresh because we're using the `RepositorySnapshot`. I added some integration tests as well to make sure collab support is working this time. Finally, adding the initial diff calculation to `compute_snapshot` didn't affect performance for me when checking against chromium's diff with HEAD~1000. So this should be a safe change to make. I decided to add diff stats on the status entry struct because it made updating changed paths and the collab database much simpler than having two separate SumTrees. Also whenever the UI got a file's status it would check its diff stat as well, so this change makes that code more streamlined as well. Before you mark this PR as ready for review, make sure that you have: - [x] Added a solid test coverage and/or screenshots from doing manual testing. - [x] Done a self-review taking into account security and performance aspects. Release Notes: - N/A
43 lines
974 B
TOML
43 lines
974 B
TOML
[package]
|
|
name = "lsp"
|
|
version = "0.1.0"
|
|
edition.workspace = true
|
|
publish.workspace = true
|
|
license = "GPL-3.0-or-later"
|
|
|
|
[lints]
|
|
workspace = true
|
|
|
|
[lib]
|
|
path = "src/lsp.rs"
|
|
doctest = false
|
|
|
|
[features]
|
|
test-support = ["async-pipe", "gpui_util"]
|
|
|
|
[dependencies]
|
|
anyhow.workspace = true
|
|
async-pipe = { workspace = true, optional = true }
|
|
collections.workspace = true
|
|
gpui_util = { workspace = true, optional = true }
|
|
futures.workspace = true
|
|
gpui.workspace = true
|
|
log.workspace = true
|
|
lsp-types.workspace = true
|
|
parking_lot.workspace = true
|
|
postage.workspace = true
|
|
serde.workspace = true
|
|
serde_json.workspace = true
|
|
schemars.workspace = true
|
|
smol.workspace = true
|
|
util.workspace = true
|
|
release_channel.workspace = true
|
|
|
|
[dev-dependencies]
|
|
async-pipe.workspace = true
|
|
gpui_util.workspace = true
|
|
ctor.workspace = true
|
|
gpui = { workspace = true, features = ["test-support"] }
|
|
semver.workspace = true
|
|
util = { workspace = true, features = ["test-support"] }
|
|
zlog.workspace = true
|