nes: cleanup: unite params by semantic proximity into entities#308481
Merged
nes: cleanup: unite params by semantic proximity into entities#308481
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the Copilot NES (next edit suggestions) Xtab provider to reduce long parameter lists by grouping semantically related values into context “entities” (e.g., tracing, edit-stream context, response options, fetch metadata), aiming to simplify call sites and improve readability within the Xtab streaming pipeline.
Changes:
- Introduces new context interfaces (
RequestTracingContext,EditStreamContext, etc.) and threads them through the provider. - Refactors streaming entry points to pass consolidated context objects instead of many individual parameters.
- Begins introducing a local fetch cancellation token source to allow early aborts (e.g., cursor-line divergence).
Show a summary per file
| File | Description |
|---|---|
| extensions/copilot/src/extension/xtab/node/xtabProvider.ts | Refactors XtabProvider streaming/request plumbing by bundling parameters into context objects and adjusting streaming/cancellation flow. |
Copilot's findings
Comments suppressed due to low confidence (1)
extensions/copilot/src/extension/xtab/node/xtabProvider.ts:730
- This new
_streamEditsImplcontains leftover wrapper logic: it re-declaresfetchCts/fetchCancellationToken(shadowing the parameters) and then delegates tothis._streamEditsImpl(...)with names that aren’t in scope here (modelServiceConfig,opts,telemetryBuilder). Besides not compiling, this also indicates two implementations of_streamEditsImplexist (the call is targeting a different signature). Consolidate to a single_streamEditsImplimplementation (preferably the new context-based one) and keep CTS creation in exactly one place (eitherstreamEditsor the impl).
// Create a local cancellation source linked to the caller's token.
// This lets us cancel the fetch immediately on cursor-line divergence
// without reaching into the request's CancellationTokenSource (which
// is owned by nextEditProvider.ts).
const fetchCts = new CancellationTokenSource(cancellationToken);
const fetchCancellationToken = fetchCts.token;
try {
return yield* this._streamEditsImpl(
request, endpoint, modelServiceConfig, messages, clippedTaggedCurrentDoc,
editWindow, editWindowLines, cursorOriginalLinesOffset, editWindowLineRange,
promptPieces, prediction, opts, delaySession, tracer, telemetryBuilder,
logContext, cancellationToken, originalEditWindow, fetchCts, fetchCancellationToken,
);
- Files reviewed: 1/1 changed files
- Comments generated: 0
alexdima
previously approved these changes
Apr 8, 2026
6b13cd9 to
8422f16
Compare
jrieken
approved these changes
Apr 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.