@@ -35,7 +35,7 @@ class ReactWebView {
3535 this . extensionPath = extensionPath
3636
3737 // Create and show a new webview panel
38- this . panel = this . createWebviewPanel ( vscode . ViewColumn . Two )
38+ this . panel = this . createWebviewPanel ( )
3939
4040 // Set the webview initial html content
4141 this . render ( )
@@ -46,22 +46,23 @@ class ReactWebView {
4646
4747
4848 // update panel on changes
49- const updateWindows = ( ) => {
50- vscode . commands . executeCommand ( 'coderoad.open_webview' )
51- }
49+ // const updateWindows = () => {
50+ // vscode.commands.executeCommand('coderoad.open_webview')
51+ // }
5252
53- // prevents new panels from going on top of coderoad panel
53+ // // prevents new panels from going on top of coderoad panel
5454 vscode . window . onDidChangeActiveTextEditor ( ( textEditor ?: vscode . TextEditor ) => {
55- // console.log('onDidChangeActiveTextEditor')
56- // console.log(textEditor)
57- if ( ! textEditor || textEditor . viewColumn !== vscode . ViewColumn . Two ) {
58- updateWindows ( )
59- }
55+ console . log ( 'onDidChangeActiveTextEditor' )
56+ console . log ( textEditor )
57+ // if (!textEditor || textEditor.viewColumn !== vscode.ViewColumn.Two) {
58+ // updateWindows()
59+ // }
6060 } )
61- // // prevents moving coderoad panel on top of left panel
61+ // // // prevents moving coderoad panel on top of left panel
6262 vscode . window . onDidChangeVisibleTextEditors ( ( textEditor : vscode . TextEditor [ ] ) => {
63- // console.log('onDidChangeVisibleTextEditors')
64- updateWindows ( )
63+ console . log ( 'onDidChangeVisibleTextEditors' )
64+ console . log ( textEditor )
65+ // updateWindows()
6566 } )
6667
6768 // TODO: prevent window from moving to the left when no windows remain on rights
@@ -81,13 +82,18 @@ class ReactWebView {
8182 this . send = this . channel . send
8283 }
8384
84- public createOrShow ( column : number ) : void {
85+ public createOrShow ( ) : void {
86+ // reset layout
87+ vscode . commands . executeCommand ( 'vscode.setEditorLayout' , {
88+ orientation : 0 ,
89+ groups : [ { groups : [ { } ] , size : 0.6 } , { groups : [ { } ] , size : 0.4 } ] ,
90+ } )
8591 // If we already have a panel, show it.
8692 // Otherwise, create a new panel.
8793 if ( this . panel && this . panel . webview ) {
88- this . panel . reveal ( column )
94+ this . panel . reveal ( vscode . ViewColumn . Two )
8995 } else {
90- this . panel = this . createWebviewPanel ( column )
96+ this . panel = this . createWebviewPanel ( )
9197 }
9298 }
9399
@@ -98,7 +104,7 @@ class ReactWebView {
98104 Promise . all ( this . disposables . map ( ( x ) => x . dispose ( ) ) )
99105 }
100106
101- private createWebviewPanel = ( column : number ) : vscode . WebviewPanel => {
107+ private createWebviewPanel = ( ) : vscode . WebviewPanel => {
102108 const viewType = 'CodeRoad'
103109 const title = 'CodeRoad'
104110 const config = {
@@ -109,7 +115,7 @@ class ReactWebView {
109115 // prevents destroying the window when it is in the background
110116 retainContextWhenHidden : true ,
111117 }
112- return vscode . window . createWebviewPanel ( viewType , title , column , config )
118+ return vscode . window . createWebviewPanel ( viewType , title , vscode . ViewColumn . Two , config )
113119 }
114120
115121 private render = async ( ) : Promise < void > => {
0 commit comments