Skip to content

Commit 28b7ef2

Browse files
committed
fix: roo code shizz not coming up
1 parent 12e5a4e commit 28b7ef2

2 files changed

Lines changed: 16 additions & 14 deletions

File tree

src/activate/registerPearListener.ts

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,38 +22,39 @@ export const getpearAIExports = async () => {
2222

2323
return pearAiExtension.exports;
2424
}
25-
25+
2626
// TODO: SHOULD HAVE TYPE SYNCED WITH THE PEARAI SUBMODULE!
2727
type CreatorModeState = "OVERLAY_CLOSED" | "OVERLAY_OPEN" | "OVERLAY_CLOSED_CREATOR_ACTIVE"
2828

29-
export const registerPearListener = async () => {
29+
export const registerPearListener = async (provider: ClineProvider) => {
3030
// Getting the pear ai extension instance
3131
const exports = await getpearAIExports()
3232

3333
exports.pearAPI.creatorMode.onDidRequestExecutePlan(async (msg: any) => {
3434
console.dir(`onDidRequestNewTask triggered with: ${JSON.stringify(msg)}`)
35-
// Get the sidebar provider
36-
let sidebarProvider = ClineProvider.getVisibleInstance()
3735

38-
// TODO: LOOK INTO THIS - THIS IS A JANKY FIX AND IT FEELS LIKE THIS IS TEMPERAMENTAL
39-
while (!sidebarProvider) {
40-
await new Promise((resolve) => setTimeout(resolve, 500))
41-
sidebarProvider = ClineProvider.getVisibleInstance()
36+
let canContinue = false;
37+
38+
while(!canContinue) {
39+
await new Promise((resolve) => setTimeout(resolve, 10));
40+
canContinue = provider.viewLaunched && provider.isViewLaunched;
4241
}
4342

43+
44+
// Get the sidebar provider
4445
// Focus the sidebar first
4546
await vscode.commands.executeCommand("pearai-roo-cline.SidebarProvider.focus")
4647

4748
// Wait for the view to be ready using a helper function
48-
await ensureViewIsReady(sidebarProvider)
49+
await ensureViewIsReady(provider)
4950
// Wait a brief moment for UI to update
50-
await new Promise((resolve) => setTimeout(resolve, 300))
51+
await new Promise((resolve) => setTimeout(resolve, 3000))
5152

5253
// * This does actually work but the UI update does not happen. This method calls this.postStateToWebview() so not sure what is going on - James
53-
await sidebarProvider.handleModeSwitch("Creator")
54+
await provider.handleModeSwitch("Creator")
5455

5556
// Clicl the chat btn
56-
await sidebarProvider.postMessageToWebview({ type: "action", action: "chatButtonClicked" })
57+
await provider.postMessageToWebview({ type: "action", action: "chatButtonClicked" })
5758

5859
const creatorModeConfig = {
5960
creatorMode: true,
@@ -63,7 +64,7 @@ export const registerPearListener = async () => {
6364

6465

6566
// Initialize with task
66-
await sidebarProvider.initClineWithTask(msg.plan, undefined, undefined, undefined, creatorModeConfig);
67+
await provider.initClineWithTask(msg.plan, undefined, undefined, undefined, creatorModeConfig);
6768
});
6869
// If there's a creator event in the cache after the extensions were refreshed, we need to get it!
6970
exports.pearAPI.creatorMode.triggerCachedCreatorEvent(true);

src/extension.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ export async function activate(context: vscode.ExtensionContext) {
7878
const provider = new ClineProvider(context, outputChannel, "sidebar", contextProxy)
7979
telemetryService.setProvider(provider)
8080

81+
registerPearListener(provider);
82+
8183
context.subscriptions.push(
8284
vscode.window.registerWebviewViewProvider(ClineProvider.sideBarId, provider, {
8385
webviewOptions: { retainContextWhenHidden: true },
@@ -208,7 +210,6 @@ export async function activate(context: vscode.ExtensionContext) {
208210

209211
registerCodeActions(context)
210212
registerTerminalActions(context)
211-
registerPearListener()
212213

213214
context.subscriptions.push(
214215
vscode.commands.registerCommand("roo-cline.focus", async (...args: any[]) => {

0 commit comments

Comments
 (0)