ZIm/crates/project/Cargo.toml
Max Brunsfeld 0fdad0c0d6
Use line-based and word-based diff when reloading and formatting buffers (#25129)
Closes https://github.com/zed-industries/zed/issues/10122
Closes https://github.com/zed-industries/zed/issues/25034

When formatting buffers or reloading them after they change on disk, we
performed a diff between the buffer's current contents and the new
content. We need this diff in order preserve the positions of cursors
and other decorations when updating the buffer's text.

In order to handle changes within lines, we would previously compute a
*character-wise* diff. This was extremely expensive for large files.

This PR gets rid of the character-wise diff, and instead performs a
normal line-wise diff. Then, for certain replace hunks, we compute a
secondary word-based diff. Also, I've switched to the
[`imara-diff`](https://github.com/pascalkuthe/imara-diff) crate, instead
of `similar`.

Release Notes:

- Fixed a hang that could occur when large files were changed on disk or
formatted.
2025-02-20 00:56:01 +00:00

95 lines
2.5 KiB
TOML

[package]
name = "project"
version = "0.1.0"
edition.workspace = true
publish.workspace = true
license = "GPL-3.0-or-later"
[lints]
workspace = true
[lib]
path = "src/project.rs"
doctest = false
[features]
test-support = [
"buffer_diff/test-support",
"client/test-support",
"language/test-support",
"settings/test-support",
"text/test-support",
"prettier/test-support",
"worktree/test-support",
"gpui/test-support",
]
[dependencies]
aho-corasick.workspace = true
anyhow.workspace = true
async-trait.workspace = true
client.workspace = true
clock.workspace = true
collections.workspace = true
buffer_diff.workspace = true
fs.workspace = true
futures.workspace = true
fuzzy.workspace = true
git.workspace = true
globset.workspace = true
gpui.workspace = true
http_client.workspace = true
itertools.workspace = true
language.workspace = true
log.workspace = true
lsp.workspace = true
node_runtime.workspace = true
image.workspace = true
parking_lot.workspace = true
pathdiff.workspace = true
paths.workspace = true
postage.workspace = true
prettier.workspace = true
worktree.workspace = true
rand.workspace = true
regex.workspace = true
remote.workspace = true
rpc.workspace = true
schemars.workspace = true
task.workspace = true
tempfile.workspace = true
serde.workspace = true
serde_json.workspace = true
settings.workspace = true
sha2.workspace = true
shellexpand.workspace = true
shlex.workspace = true
smol.workspace = true
snippet.workspace = true
snippet_provider.workspace = true
terminal.workspace = true
text.workspace = true
toml.workspace = true
util.workspace = true
url.workspace = true
which.workspace = true
fancy-regex.workspace = true
[dev-dependencies]
client = { workspace = true, features = ["test-support"] }
collections = { workspace = true, features = ["test-support"] }
buffer_diff = { workspace = true, features = ["test-support"] }
env_logger.workspace = true
fs = { workspace = true, features = ["test-support"] }
git2.workspace = true
gpui = { workspace = true, features = ["test-support"] }
language = { workspace = true, features = ["test-support"] }
release_channel.workspace = true
lsp = { workspace = true, features = ["test-support"] }
prettier = { workspace = true, features = ["test-support"] }
pretty_assertions.workspace = true
worktree = { workspace = true, features = ["test-support"] }
rpc = { workspace = true, features = ["test-support"] }
settings = { workspace = true, features = ["test-support"] }
unindent.workspace = true
util = { workspace = true, features = ["test-support"] }