# edit_file: Let agent specify locations of edit chunks \(\#32628\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 5d293ae8ace9fe14e0c868a2582f5d304772c85b

Requested commit: 5d293ae8ace9fe14e0c868a2582f5d304772c85b

Commit: 5d293ae8ace9fe14e0c868a2582f5d304772c85b

Tree: e0c6c3abba05701ace6baa43ff33470afaa4e0f3

Author: Oleksiy Syvokon

Committer: GitHub

## Message

```
edit_file: Let agent specify locations of edit chunks (#32628)

These changes help the agent edit files when `<old_text>` matches more
than one location.

First, the agent can specify an optional `<old_text line=XX>` parameter.
When this is provided and multiple matches exist, we use this hint to
identify the best match.

Second, when there is ambiguity in matches, we now return the agent a
more helpful message listing the line numbers of all possible matches.

Together, these changes should reduce the number of misplaced edits and
agent confusion.

I have ensured the LLM Worker works with these prompt changes.


Release Notes:

- Agent: Improved locating edits
```

## Parents

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

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