ZIm/crates/assistant2/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
..
context_picker assistant2: Add file icons for mentioned creases (#25111) 2025-02-18 18:22:01 -03:00
ui Eliminate GPUI View, ViewContext, and WindowContext types (#22632) 2025-01-26 03:02:45 +00:00
active_thread.rs Remove language::markdown (#25136) 2025-02-19 08:55:36 -07:00
assistant.rs assistant2: Fix thread history only working in one Zed window (#25119) 2025-02-18 22:44:43 +00:00
assistant_configuration.rs assistant2: Tweak the settings UI (#23845) 2025-01-29 16:20:09 -03:00
assistant_model_selector.rs assistant: Improve the language model selector (#25125) 2025-02-18 21:01:09 -03:00
assistant_panel.rs assistant2: Fix thread history only working in one Zed window (#25119) 2025-02-18 22:44:43 +00:00
buffer_codegen.rs Use line-based and word-based diff when reloading and formatting buffers (#25129) 2025-02-20 00:56:01 +00:00
context.rs Eliminate GPUI View, ViewContext, and WindowContext types (#22632) 2025-01-26 03:02:45 +00:00
context_picker.rs Remove more references to 'model' in GPUI APIs (#23693) 2025-01-27 04:00:27 +00:00
context_store.rs cx.background_executor().spawn(...) -> cx.background_spawn(...) (#25103) 2025-02-18 20:30:33 +00:00
context_strip.rs Revert "file_finder: Remove common segments of long paths in search results (#25049)" (#25163) 2025-02-19 15:32:29 +00:00
inline_assistant.rs Revert "file_finder: Remove common segments of long paths in search results (#25049)" (#25163) 2025-02-19 15:32:29 +00:00
inline_prompt_editor.rs Revert "file_finder: Remove common segments of long paths in search results (#25049)" (#25163) 2025-02-19 15:32:29 +00:00
message_editor.rs Display case-sensitive keybindings for vim commands (#24322) 2025-02-14 22:03:59 -07:00
terminal_codegen.rs cx.background_executor().spawn(...) -> cx.background_spawn(...) (#25103) 2025-02-18 20:30:33 +00:00
terminal_inline_assistant.rs Remove more references to 'model' in GPUI APIs (#23693) 2025-01-27 04:00:27 +00:00
thread.rs Eliminate GPUI View, ViewContext, and WindowContext types (#22632) 2025-01-26 03:02:45 +00:00
thread_history.rs assistant2: Add tiny visual adjustments (#23748) 2025-01-27 20:26:34 -03:00
thread_store.rs assistant2: Fix thread history only working in one Zed window (#25119) 2025-02-18 22:44:43 +00:00
ui.rs assistant2: Sketch in sending file context to model (#21829) 2024-12-10 16:35:53 -05:00