Files
Ulugbek Abdullaev 4fc2b3348b NES: cache cross-file suggestions under the active document (#323150)
* NES: cache cross-file suggestions under the active document

When the model returns a Next Edit Suggestion for a document other than
the one being edited (cross-file NES), it was only cached under the target
document, so it could not be re-served until the user navigated there.
Also cache an `activeDoc (content + edit window) -> edit-in-target`
association so the suggestion can be re-served from cache while the cursor
is still in the active document.

A cross-file entry is served only while its target document is open and
byte-identical to the snapshot the edit's offsets index into; otherwise the
read path treats it as a cache miss and refetches, rather than serving a
misplaced edit or getting stuck re-serving a dead entry until the active
document changes. At stream end the active document is no longer cached as
"no edit" when a cross-file entry was just stored under the same key, which
would otherwise clobber it.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Dispose provider and documents in runCrossFileScenario

Tear down the NextEditProvider (which registers autoruns/watchers on
openDocuments) and both documents at the end of each cross-file scenario
run so the tests are self-contained and do not accumulate observers.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-06-27 17:02:55 +05:00
..