-
Couldn't load subscription status.
- Fork 2.3k
Focus the extension when receiving bridge commands #7633
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.
Thank you for your contribution! I've reviewed the changes and found that the implementation is solid overall. The refactoring to use the template method pattern in BaseChannel is a clean architectural improvement. I've left some suggestions inline to help improve error handling and robustness.
| */ | ||
| public async handleCommand(command: TCommand): Promise<void> { | ||
| // Common functionality: focus the sidebar | ||
| await vscode.commands.executeCommand(`${this.extensionMetadata.name}.SidebarProvider.focus`) |
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.
Good implementation of the template method pattern! The separation between common functionality (focus) and subclass-specific logic is clean.
However, I have two concerns about the focus command execution:
-
Potential Race Condition: The focus command is executed asynchronously, but we don't wait for confirmation that the focus actually succeeded before proceeding. Could this lead to commands being processed before the UI is ready?
-
Error Handling: Consider wrapping this in a try-catch block. If the focus command fails (e.g., extension not fully loaded), should we still proceed with command handling?
| { | ||
| "name": "@roo-code/types", | ||
| "version": "1.69.0", | ||
| "version": "1.70.0", |
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.
Is this version bump following semantic versioning correctly? This seems like a minor feature addition (adding focus behavior) rather than a breaking change. Should this perhaps be 1.69.1 instead of 1.70.0?
|
|
||
| // Create extension channel instance | ||
| extensionChannel = new ExtensionChannel(instanceId, userId, mockProvider) | ||
| extensionChannel = new ExtensionChannel({ |
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.
Good job updating the tests to accommodate the new constructor signatures! However, would it be valuable to add specific tests that verify the focus command is called before command handling? This would help ensure the new behavior is properly tested.
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.
Looks good, the only issue is the failing unit test
fix.mp4
Important
Focuses the extension's sidebar when receiving bridge commands by updating
BaseChanneland refactoringBridgeOrchestrator.BaseChannelnow focuses the sidebar usingvscode.commands.executeCommandbefore handling commands.BridgeOrchestratorrefactored to separateconnectanddisconnectlogic.BaseChannel: UpdatedhandleCommandto focus sidebar before delegating tohandleCommandImplementation.BridgeOrchestrator: RefactoredconnectOrDisconnectintoconnectanddisconnectmethods.ExtensionChannelandTaskChannel: Updated constructors to useBaseChannelOptions.ExtensionChannel.test.tsandTaskChannel.test.tsto reflect changes in command handling and channel initialization.This description was created by
for ca86c7b. You can customize this summary. It will automatically update as commits are pushed.