@@ -41,7 +41,8 @@ export class VsCodeExtension {
41
41
private ide : VsCodeIde ;
42
42
private tabAutocompleteModel : TabAutocompleteModel ;
43
43
private sidebar : ContinueGUIWebviewViewProvider ;
44
- private windowId : string ;
44
+ private sidebar2 : ContinueGUIWebviewViewProvider ;
45
+ private activeWebview : 'sidebar' | 'sidebar2' = 'sidebar' ; private windowId : string ;
45
46
private diffManager : DiffManager ;
46
47
private verticalDiffManager : VerticalPerLineDiffManager ;
47
48
webviewProtocolPromise : Promise < VsCodeWebviewProtocol > ;
@@ -95,6 +96,29 @@ export class VsCodeExtension {
95
96
) ;
96
97
resolveWebviewProtocol ( this . sidebar . webviewProtocol ) ;
97
98
99
+ this . sidebar2 = new ContinueGUIWebviewViewProvider (
100
+ configHandlerPromise ,
101
+ this . windowId + "_2" ,
102
+ this . extensionContext ,
103
+ ) ;
104
+
105
+ // Register second sidebar
106
+ context . subscriptions . push (
107
+ vscode . window . registerWebviewViewProvider (
108
+ "pearai.continueGUIView2" ,
109
+ this . sidebar2 ,
110
+ {
111
+ webviewOptions : { retainContextWhenHidden : true } ,
112
+ } ,
113
+ ) ,
114
+ ) ;
115
+
116
+ context . subscriptions . push (
117
+ vscode . commands . registerCommand ( "pearai.internal.switchWebview" , ( ) => {
118
+ this . switchWebview ( ) ;
119
+ } )
120
+ ) ;
121
+
98
122
// Config Handler with output channel
99
123
const outputChannel = vscode . window . createOutputChannel (
100
124
"PearAI" ,
@@ -372,6 +396,21 @@ export class VsCodeExtension {
372
396
373
397
static continueVirtualDocumentScheme = "pearai" ;
374
398
399
+ public switchWebview ( ) {
400
+ this . activeWebview = this . activeWebview === 'sidebar' ? 'sidebar2' : 'sidebar' ;
401
+ const activeProvider = this . activeWebview === 'sidebar' ? this . sidebar : this . sidebar2 ;
402
+
403
+ this . webviewProtocolPromise . then ( protocol => {
404
+ if ( activeProvider . webview ) {
405
+ protocol . webview = activeProvider . webview ;
406
+ }
407
+ } ) ;
408
+ // Refresh the webview content
409
+ activeProvider . webviewProtocol ?. request ( "didChangeAvailableProfiles" , { profiles : [ ] } ) ;
410
+
411
+ vscode . commands . executeCommand ( `pearai.continueGUIView${ this . activeWebview === 'sidebar' ? '' : '2' } .focus` ) ;
412
+ }
413
+
375
414
// eslint-disable-next-line @typescript-eslint/naming-convention
376
415
private PREVIOUS_BRANCH_FOR_WORKSPACE_DIR : { [ dir : string ] : string } = { } ;
377
416
0 commit comments