# edit prediction: Try to fix panic in \`Buffer::preview_edits\` \(\#24654\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 8fa85c41a16b4736bbabe1055691bf65e1f4b7c7

Requested commit: 8fa85c41a16b4736bbabe1055691bf65e1f4b7c7

Commit: 8fa85c41a16b4736bbabe1055691bf65e1f4b7c7

Tree: b418dcffb6c9cc055e24628de818a4278e886ab0

Author: Bennet Bo Fenner

Committer: GitHub

## Message

```
edit prediction: Try to fix panic in `Buffer::preview_edits` (#24654)

We've seen a few crashes in `SyntaxSnapshot::reparse_with_ranges` during
`Buffer::preview_edits`, where an offset conversion fails because it is
out of range.
We are not sure how exactly this is happening. 
Our theory is that the syntax snapshot is using an outdated state when
edits happen in the meantime (while interpolating). This is an attempt
to see if it helps with the panics, hopefully we can revisit this when
we have a better understanding of the issue.


Co-Authored-by: Antonio <antonio@zed.dev>

Release Notes:

- N/A

Co-authored-by: Antonio <antonio@zed.dev>
```

## Parents

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

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