# assistant edit tool: Use buffer search and replace in background \(\#26679\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/8ec0309645a2a813ce470e9122e30e3ac71b01e2)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 8ec0309645a2a813ce470e9122e30e3ac71b01e2

Requested commit: 8ec0309645a2a813ce470e9122e30e3ac71b01e2

Commit: 8ec0309645a2a813ce470e9122e30e3ac71b01e2

Tree: c4469d5b6638877667ceab32f212a30037ae9631

Author: Agus Zubiaga

Committer: GitHub

## Message

```
assistant edit tool: Use buffer search and replace in background (#26679)

Instead of getting the whole text from the buffer, replacing with
`String::replace`, and getting a whole diff, we'll now use `SearchQuery`
to get a range, diff only that range, and apply it (all in the
background).

When we match zero strings, we'll record a "bad search", keep going and
report it to the model at the end.

Release Notes:

- N/A

---------

Co-authored-by: Max <max@zed.dev>
```

## Parents

- [6767e98e0080b528b3bd9ffb3ed484c7b4703670](https://git.cafe/gitcafe/zed/commit/6767e98e0080b528b3bd9ffb3ed484c7b4703670?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/8ec0309645a2a813ce470e9122e30e3ac71b01e2?format=markdown)
