-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Fix NESProvider in chat-lib #2570
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this 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 fixes a breaking change in the NESProvider used by chat-lib by refactoring the UndesiredModelsManager to support optional dependency injection. The issue occurred when IVSCodeExtensionContext was added as a direct dependency to InlineEditsModelService, causing library consumers without VS Code extension context to fail.
Key changes:
- Extracted
IUndesiredModelsManagerinterface to enable dependency injection and alternative implementations - Moved
UndesiredModels.Managerfrom node implementation to common interface layer for reusability - Added
NullUndesiredModelsManageras a no-op implementation for library consumers - Made
undesiredModelsManageran optional parameter inINESProviderOptionsfor chat-lib users
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/platform/inlineEdits/node/inlineEditsModelService.ts |
Removed direct IVSCodeExtensionContext dependency and UndesiredModels namespace; replaced with injected IUndesiredModelsManager service |
src/platform/inlineEdits/common/inlineEditsModelService.ts |
Added IUndesiredModelsManager interface, moved UndesiredModels.Manager implementation here, and added NullUndesiredModelsManager null implementation |
src/lib/node/chatLibMain.ts |
Added optional undesiredModelsManager parameter to INESProviderOptions and registered service with fallback to null implementation |
src/extension/extension/vscode/services.ts |
Registered UndesiredModels.Manager as the implementation of IUndesiredModelsManager for the VS Code extension |
The refactoring successfully decouples the platform service from VS Code-specific APIs while maintaining functionality for extension consumers and enabling library consumers to provide their own implementations or use the default no-op behavior.
b257d47 to
ae98bf1
Compare
…VSCodeExtensionContext
ae98bf1 to
01741b5
Compare
chrmarti
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
The addition of the
IVSCodeExtensionContextdependency inInlineEditsModelServicecausesNESProviderin chat-lib to break (and publishing to fail) because of the missing dependency that shows up in a failing test:Can we do this to get
NESProviderworking again (and with the option for library users to provide an implementation if they choose)?