Skip to content

switch to async producer for variable Provider#270230

Merged
amunger merged 1 commit into
mainfrom
aamunger/variableProducer
Oct 7, 2025
Merged

switch to async producer for variable Provider#270230
amunger merged 1 commit into
mainfrom
aamunger/variableProducer

Conversation

@amunger
Copy link
Copy Markdown
Collaborator

@amunger amunger commented Oct 7, 2025

#256854

the variable results are only cached in the extension, every request creates a new async iterable in the workbench, so this is a good candidate to migrate.

@amunger amunger marked this pull request as ready for review October 7, 2025 20:19
Copilot AI review requested due to automatic review settings October 7, 2025 20:19
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 migrates the notebook variable provider from AsyncIterableObject and AsyncIterableSource to the new AsyncIterableProducer pattern. The change improves performance by eliminating redundant async iterable creation on each request, as variable results are cached in the extension layer.

Key changes:

  • Updated the provideVariables method signature to return AsyncIterableProducer<VariablesResult> instead of AsyncIterableObject<VariablesResult>
  • Replaced AsyncIterableSource usage with AsyncIterableProducer constructor pattern
  • Updated all call sites to work with the new async producer pattern

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/vs/workbench/contrib/notebook/common/notebookKernelService.ts Updated interface signature for provideVariables method
src/vs/workbench/api/browser/mainThreadNotebookKernels.ts Refactored variable request handling to use AsyncIterableProducer
src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesDataSource.ts Updated to iterate directly over async producer instead of using .map().toPromise()
src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariableCommands.ts Replaced .map().toPromise() pattern with direct iteration
src/vs/workbench/contrib/notebook/browser/controller/chat/notebook.chat.contribution.ts Removed await from provideVariables call since it now returns producer directly
src/vs/workbench/contrib/notebook/test/browser/notebookVariablesDataSource.test.ts Updated test implementation to use AsyncIterableProducer
src/vs/workbench/contrib/notebook/test/browser/notebookKernelService.test.ts Updated test mock to return AsyncIterableProducer.EMPTY
src/vs/workbench/contrib/notebook/test/browser/notebookKernelHistory.test.ts Updated test mock to return AsyncIterableProducer.EMPTY
src/vs/workbench/contrib/notebook/test/browser/notebookExecutionStateService.test.ts Updated test mock to return AsyncIterableProducer.EMPTY
src/vs/workbench/contrib/notebook/test/browser/notebookExecutionService.test.ts Updated test mock to return AsyncIterableProducer.EMPTY

@vs-code-engineering vs-code-engineering Bot added this to the October 2025 milestone Oct 7, 2025
@amunger amunger merged commit 10a353b into main Oct 7, 2025
28 checks passed
@amunger amunger deleted the aamunger/variableProducer branch October 7, 2025 21:11
@vs-code-engineering vs-code-engineering Bot locked and limited conversation to collaborators Nov 21, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants