Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/activate/registerCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,16 @@ const getCommandsMap = ({ context, outputChannel, provider }: RegisterCommandOpt
const { promptForCustomStoragePath } = await import("../shared/storagePathManager")
await promptForCustomStoragePath()
},
"roo-cline.focusInput": () => {
provider.postMessageToWebview({ type: "action", action: "focusInput" })
"roo-cline.focusInput": async () => {
const panel = getPanel()
if (!panel) {
await vscode.commands.executeCommand("workbench.view.extension.roo-cline-ActivityBar")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When the panel is not found, the command workbench.view.extension.roo-cline-ActivityBar is executed to trigger its creation. Consider whether additional logic (such as a delay or a follow-up focus message) is required after the panel is created to reliably focus the input, avoiding potential race conditions.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hongzio thoughts on this? I had the same question reading this. Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the feedback. I have confirmed that when the workbench.view.extension.roo-cline-ActivityBar command completes, the input is properly focused. I've also verified that repeatedly executing focusInput during the initialization process, which takes about 3 seconds, works as intended.
As this is my first time developing with TypeScript and VSCode extensions, I'm not entirely sure about the level of synchronization needed for this block. Could you provide some guidance on this matter?

} else if (panel === tabPanel) {
panel.reveal(vscode.ViewColumn.Active, false)
} else if (panel === sidebarPanel) {
await vscode.commands.executeCommand(`${ClineProvider.sideBarId}.focus`)
provider.postMessageToWebview({ type: "action", action: "focusInput" })
}
},
"roo.acceptInput": () => {
const visibleProvider = getVisibleProviderOrLog(outputChannel)
Expand Down