switch to async producer for variable Provider#270230
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
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
provideVariablesmethod signature to returnAsyncIterableProducer<VariablesResult>instead ofAsyncIterableObject<VariablesResult> - Replaced
AsyncIterableSourceusage withAsyncIterableProducerconstructor 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 |
dmitrivMS
approved these changes
Oct 7, 2025
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
#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.