Skip to content

Commit 7d7ca43

Browse files
committed
Show menu buttons in tab view
1 parent 065c5ab commit 7d7ca43

File tree

2 files changed

+69
-7
lines changed

2 files changed

+69
-7
lines changed

package.json

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,43 @@
265265
"group": "navigation@7",
266266
"when": "view == roo-cline.SidebarProvider"
267267
}
268+
],
269+
"editor/title": [
270+
{
271+
"command": "roo-cline.plusButtonClicked",
272+
"group": "navigation@1",
273+
"when": "activeWebviewPanelId == roo-cline.TabPanelProvider"
274+
},
275+
{
276+
"command": "roo-cline.promptsButtonClicked",
277+
"group": "navigation@2",
278+
"when": "activeWebviewPanelId == roo-cline.TabPanelProvider"
279+
},
280+
{
281+
"command": "roo-cline.mcpButtonClicked",
282+
"group": "navigation@3",
283+
"when": "activeWebviewPanelId == roo-cline.TabPanelProvider"
284+
},
285+
{
286+
"command": "roo-cline.historyButtonClicked",
287+
"group": "navigation@4",
288+
"when": "activeWebviewPanelId == roo-cline.TabPanelProvider"
289+
},
290+
{
291+
"command": "roo-cline.popoutButtonClicked",
292+
"group": "navigation@5",
293+
"when": "activeWebviewPanelId == roo-cline.TabPanelProvider"
294+
},
295+
{
296+
"command": "roo-cline.settingsButtonClicked",
297+
"group": "navigation@6",
298+
"when": "activeWebviewPanelId == roo-cline.TabPanelProvider"
299+
},
300+
{
301+
"command": "roo-cline.helpButtonClicked",
302+
"group": "navigation@7",
303+
"when": "activeWebviewPanelId == roo-cline.TabPanelProvider"
304+
}
268305
]
269306
},
270307
"configuration": {

src/activate/registerCommands.ts

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,23 +52,48 @@ const getCommandsMap = ({ context, outputChannel, provider }: RegisterCommandOpt
5252
return {
5353
"roo-cline.activationCompleted": () => {},
5454
"roo-cline.plusButtonClicked": async () => {
55-
await provider.removeClineFromStack()
56-
await provider.postStateToWebview()
57-
await provider.postMessageToWebview({ type: "action", action: "chatButtonClicked" })
55+
const visibleProvider = ClineProvider.getVisibleInstance()
56+
if (!visibleProvider) {
57+
outputChannel.appendLine("Cannot find any visible Cline instances.")
58+
return
59+
}
60+
await visibleProvider.removeClineFromStack()
61+
await visibleProvider.postStateToWebview()
62+
await visibleProvider.postMessageToWebview({ type: "action", action: "chatButtonClicked" })
5863
},
5964
"roo-cline.mcpButtonClicked": () => {
60-
provider.postMessageToWebview({ type: "action", action: "mcpButtonClicked" })
65+
const visibleProvider = ClineProvider.getVisibleInstance()
66+
if (!visibleProvider) {
67+
outputChannel.appendLine("Cannot find any visible Cline instances.")
68+
return
69+
}
70+
visibleProvider.postMessageToWebview({ type: "action", action: "mcpButtonClicked" })
6171
},
6272
"roo-cline.promptsButtonClicked": () => {
63-
provider.postMessageToWebview({ type: "action", action: "promptsButtonClicked" })
73+
const visibleProvider = ClineProvider.getVisibleInstance()
74+
if (!visibleProvider) {
75+
outputChannel.appendLine("Cannot find any visible Cline instances.")
76+
return
77+
}
78+
visibleProvider.postMessageToWebview({ type: "action", action: "promptsButtonClicked" })
6479
},
6580
"roo-cline.popoutButtonClicked": () => openClineInNewTab({ context, outputChannel }),
6681
"roo-cline.openInNewTab": () => openClineInNewTab({ context, outputChannel }),
6782
"roo-cline.settingsButtonClicked": () => {
68-
provider.postMessageToWebview({ type: "action", action: "settingsButtonClicked" })
83+
const visibleProvider = ClineProvider.getVisibleInstance()
84+
if (!visibleProvider) {
85+
outputChannel.appendLine("Cannot find any visible Cline instances.")
86+
return
87+
}
88+
visibleProvider.postMessageToWebview({ type: "action", action: "settingsButtonClicked" })
6989
},
7090
"roo-cline.historyButtonClicked": () => {
71-
provider.postMessageToWebview({ type: "action", action: "historyButtonClicked" })
91+
const visibleProvider = ClineProvider.getVisibleInstance()
92+
if (!visibleProvider) {
93+
outputChannel.appendLine("Cannot find any visible Cline instances.")
94+
return
95+
}
96+
visibleProvider.postMessageToWebview({ type: "action", action: "historyButtonClicked" })
7297
},
7398
"roo-cline.helpButtonClicked": () => {
7499
vscode.env.openExternal(vscode.Uri.parse("https://docs.roocode.com"))

0 commit comments

Comments
 (0)