Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new Component Explorer fixture to render and visually validate the Chat “Prompt File” / “Instruction File” picker UI in the workbench test fixtures.
Changes:
- Introduces
promptFilePickers.fixture.tswith two themed fixtures (prompt files + instruction files with agent instruction files). - Provides mocked
IPromptsServicedata sources and minimal layout/context/quick-input services to host the Quick Pick UI.
| const instantiationService = createEditorServices(disposableStore, { | ||
| colorTheme: theme, | ||
| additionalServices: registration => { | ||
| registration.defineInstance(ILayoutService, layoutService); | ||
| registration.defineInstance(IContextMenuService, contextMenuService); | ||
| registration.defineInstance(IContextViewService, contextViewService); | ||
| registration.define(IListService, ListService); | ||
| registration.define(IQuickInputService, FixtureQuickInputService); | ||
| registration.defineInstance(IPromptsService, promptsService); | ||
| registration.defineInstance(IOpenerService, new class extends mock<IOpenerService>() { }); | ||
| registration.defineInstance(IFileService, new class extends mock<IFileService>() { }); | ||
| registration.defineInstance(IDialogService, new class extends mock<IDialogService>() { }); | ||
| registration.defineInstance(ICommandService, new class extends mock<ICommandService>() { }); | ||
| registration.defineInstance(ILabelService, new class extends mock<ILabelService>() { | ||
| override getUriLabel(uri: URI): string { | ||
| return uri.path; | ||
| } | ||
| }); | ||
| registration.defineInstance(IProductService, new class extends mock<IProductService>() { }); | ||
| } | ||
| }); | ||
|
|
||
| const pickers = instantiationService.createInstance(PromptFilePickers); | ||
|
|
||
| void pickers.selectPromptFile({ | ||
| placeholder, | ||
| type, | ||
| }); |
There was a problem hiding this comment.
This fixture creates a QuickInputService/QuickInputController (via PromptFilePickers) which registers global window listeners (key/mouse modifiers). createEditorServices uses TestInstantiationService without proper disposal of services created from SyncDescriptors, so those listeners can leak when the fixture is torn down / switched. Consider explicitly instantiating the IQuickInputService here and registering it with disposableStore for disposal (and optionally hiding any active quick input on dispose).
| return promptsState.userPromptFiles.filter(file => file.type === type); | ||
| case PromptsStorage.extension: | ||
| return promptsState.extensionPromptFiles.filter(file => file.type === type); | ||
| } |
There was a problem hiding this comment.
listPromptFilesForStorage doesn't return a value for the (theoretically) fallthrough path of the switch (storage), which will cause a TS error (Function lacks ending return statement...). Add an explicit default/throw (e.g. return an empty array or throw/assertNever) after the switch so the function always returns IPromptPath[].
| } | |
| } | |
| return []; |
No description provided.