@@ -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