copilot: Fix panic in Copilot edit prediction due to anchor/snapshot mismatch (#46022)

When `trim_completion()` creates new anchors from the current buffer
state, `completion.snapshot` was not being updated, leaving it with the
older snapshot from when the prediction was initially fetched. This
caused a panic in `interpolate_edits()` when trying to resolve anchors
with Lamport timestamps newer than what the old snapshot had observed.

The fix ensures that `completion.snapshot` is updated whenever new
anchors are created in `trim_completion()`, keeping the snapshot and
anchors consistent.

Closes #45956

Release Notes:

- Fixed a panic in Copilot edit predictions caused by anchor/snapshot
version mismatch
5505e63a0dVadim Suharnikov committed on 1/4/2026, 2:12:53 PM· committed by GitHubparent48a1092
1 file changedLine totals unavailable