@@ -42,33 +42,24 @@ export function activate(context: vscode.ExtensionContext) {
4242
4343 context . subscriptions . push (
4444 vscode . commands . registerCommand ( "cline.plusButtonClicked" , async ( ) => {
45- Logger . log ( "Plus button Clicked" )
46- const visibleWebview = WebviewProvider . getVisibleInstance ( )
47- if ( ! visibleWebview ) {
48- Logger . log ( "Cannot find any visible Cline instances." )
49- return
50- }
51-
52- await visibleWebview . controller . clearTask ( )
53- await visibleWebview . controller . postStateToWebview ( )
54- await visibleWebview . controller . postMessageToWebview ( {
55- type : "action" ,
56- action : "chatButtonClicked" ,
45+ WebviewProvider . getAllInstances ( ) . forEach ( async ( instance ) => {
46+ await instance . controller . clearTask ( )
47+ await instance . controller . postStateToWebview ( )
48+ await instance . controller . postMessageToWebview ( {
49+ type : "action" ,
50+ action : "chatButtonClicked" ,
51+ } )
5752 } )
5853 } ) ,
5954 )
6055
6156 context . subscriptions . push (
6257 vscode . commands . registerCommand ( "cline.mcpButtonClicked" , ( ) => {
63- const visibleWebview = WebviewProvider . getVisibleInstance ( )
64- if ( ! visibleWebview ) {
65- Logger . log ( "Cannot find any visible Cline instances." )
66- return
67- }
68-
69- visibleWebview . controller . postMessageToWebview ( {
70- type : "action" ,
71- action : "mcpButtonClicked" ,
58+ WebviewProvider . getAllInstances ( ) . forEach ( ( instance ) => {
59+ instance . controller . postMessageToWebview ( {
60+ type : "action" ,
61+ action : "mcpButtonClicked" ,
62+ } )
7263 } )
7364 } ) ,
7465 )
@@ -111,46 +102,33 @@ export function activate(context: vscode.ExtensionContext) {
111102
112103 context . subscriptions . push (
113104 vscode . commands . registerCommand ( "cline.settingsButtonClicked" , ( ) => {
114- //vscode.window.showInformationMessage(message)
115- const visibleWebview = WebviewProvider . getVisibleInstance ( )
116- if ( ! visibleWebview ) {
117- Logger . log ( "Cannot find any visible Cline instances." )
118- return
119- }
120-
121- visibleWebview . controller . postMessageToWebview ( {
122- type : "action" ,
123- action : "settingsButtonClicked" ,
105+ WebviewProvider . getAllInstances ( ) . forEach ( ( instance ) => {
106+ instance . controller . postMessageToWebview ( {
107+ type : "action" ,
108+ action : "settingsButtonClicked" ,
109+ } )
124110 } )
125111 } ) ,
126112 )
127113
128114 context . subscriptions . push (
129115 vscode . commands . registerCommand ( "cline.historyButtonClicked" , ( ) => {
130- const visibleWebview = WebviewProvider . getVisibleInstance ( )
131- if ( ! visibleWebview ) {
132- Logger . log ( "Cannot find any visible Cline instances." )
133- return
134- }
135-
136- visibleWebview . controller . postMessageToWebview ( {
137- type : "action" ,
138- action : "historyButtonClicked" ,
116+ WebviewProvider . getAllInstances ( ) . forEach ( ( instance ) => {
117+ instance . controller . postMessageToWebview ( {
118+ type : "action" ,
119+ action : "historyButtonClicked" ,
120+ } )
139121 } )
140122 } ) ,
141123 )
142124
143125 context . subscriptions . push (
144126 vscode . commands . registerCommand ( "cline.accountButtonClicked" , ( ) => {
145- const visibleWebview = WebviewProvider . getVisibleInstance ( )
146- if ( ! visibleWebview ) {
147- Logger . log ( "Cannot find any visible Cline instances." )
148- return
149- }
150-
151- visibleWebview . controller . postMessageToWebview ( {
152- type : "action" ,
153- action : "accountButtonClicked" ,
127+ WebviewProvider . getAllInstances ( ) . forEach ( ( instance ) => {
128+ instance . controller . postMessageToWebview ( {
129+ type : "action" ,
130+ action : "accountButtonClicked" ,
131+ } )
154132 } )
155133 } ) ,
156134 )
0 commit comments