Skip to content

nes: cleanup: unite params by semantic proximity into entities#308481

Merged
ulugbekna merged 1 commit intomainfrom
ulugbekna/xtab-cleanup
Apr 8, 2026
Merged

nes: cleanup: unite params by semantic proximity into entities#308481
ulugbekna merged 1 commit intomainfrom
ulugbekna/xtab-cleanup

Conversation

@ulugbekna
Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings April 8, 2026 11:02
@ulugbekna ulugbekna enabled auto-merge (squash) April 8, 2026 11:02
@ulugbekna ulugbekna self-assigned this Apr 8, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 _streamEditsImpl contains leftover wrapper logic: it re-declares fetchCts/fetchCancellationToken (shadowing the parameters) and then delegates to this._streamEditsImpl(...) with names that aren’t in scope here (modelServiceConfig, opts, telemetryBuilder). Besides not compiling, this also indicates two implementations of _streamEditsImpl exist (the call is targeting a different signature). Consolidate to a single _streamEditsImpl implementation (preferably the new context-based one) and keep CTS creation in exactly one place (either streamEdits or 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
alexdima previously approved these changes Apr 8, 2026
@ulugbekna ulugbekna merged commit 5fe8ed6 into main Apr 8, 2026
23 checks passed
@ulugbekna ulugbekna deleted the ulugbekna/xtab-cleanup branch April 8, 2026 12:56
@vs-code-engineering vs-code-engineering Bot added this to the 1.116.0 milestone Apr 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants