ZIm/crates/language/src
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
..
syntax_map Bump Tree-sitter for bug fixes affecting YAML parser loaded via WASM (#25054) 2025-02-17 21:29:27 -08:00
buffer.rs Use line-based and word-based diff when reloading and formatting buffers (#25129) 2025-02-20 00:56:01 +00:00
buffer_tests.rs Use line-based and word-based diff when reloading and formatting buffers (#25129) 2025-02-20 00:56:01 +00:00
diagnostic_set.rs zeta: Send up diagnostics with prediction requests (#24384) 2025-02-06 18:07:26 +00:00
highlight_map.rs Docs for indent_size_for_line and co 2024-01-09 20:50:34 +01:00
language.rs Use line-based and word-based diff when reloading and formatting buffers (#25129) 2025-02-20 00:56:01 +00:00
language_registry.rs cx.background_executor().spawn(...) -> cx.background_spawn(...) (#25103) 2025-02-18 20:30:33 +00:00
language_settings.rs Add allow_rewrap setting to control editor::Rewrap behavior for a given language (#25173) 2025-02-19 16:37:39 +00:00
outline.rs Fix panic when outline items have no name (#24574) 2025-02-10 18:50:26 +00:00
proto.rs Fix #24081 - lsp diagnostic code type conversion (#24347) 2025-02-05 21:23:46 -06:00
syntax_map.rs Revert "file_finder: Remove common segments of long paths in search results (#25049)" (#25163) 2025-02-19 15:32:29 +00:00
task_context.rs Eliminate GPUI View, ViewContext, and WindowContext types (#22632) 2025-01-26 03:02:45 +00:00
text_diff.rs Use line-based and word-based diff when reloading and formatting buffers (#25129) 2025-02-20 00:56:01 +00:00
toolchain.rs Fix missed renames in #22632 (#23688) 2025-01-26 23:37:34 +00:00