@@ -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,23 +46,16 @@ 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
54- 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- }
60- } )
61- // // prevents moving coderoad panel on top of left panel
62- vscode . window . onDidChangeVisibleTextEditors ( ( textEditor : vscode . TextEditor [ ] ) => {
63- // console.log('onDidChangeVisibleTextEditors')
64- updateWindows ( )
65- } )
53+ // // // prevents moving coderoad panel on top of left panel
54+ // vscode.window.onDidChangeVisibleTextEditors((textEditors: vscode.TextEditor[]) => {
55+ // console.log('onDidChangeVisibleTextEditors')
56+ // console.log(textEditors)
57+ // // updateWindows()
58+ // })
6659
6760 // TODO: prevent window from moving to the left when no windows remain on rights
6861
@@ -81,13 +74,21 @@ class ReactWebView {
8174 this . send = this . channel . send
8275 }
8376
84- public createOrShow ( column : number ) : void {
77+ public createOrShow ( ) : void {
78+ vscode . commands . executeCommand ( 'vscode.setEditorLayout' , {
79+ orientation : 0 ,
80+ groups : [ { groups : [ { } ] , size : 0.6 } , { groups : [ { } ] , size : 0.4 } ] ,
81+ } )
8582 // If we already have a panel, show it.
8683 // Otherwise, create a new panel.
84+
8785 if ( this . panel && this . panel . webview ) {
88- this . panel . reveal ( column )
86+ if ( ! this . loaded ) {
87+ this . panel . reveal ( vscode . ViewColumn . Two )
88+ this . loaded = true
89+ }
8990 } else {
90- this . panel = this . createWebviewPanel ( column )
91+ this . panel = this . createWebviewPanel ( )
9192 }
9293 }
9394
@@ -98,7 +99,7 @@ class ReactWebView {
9899 Promise . all ( this . disposables . map ( ( x ) => x . dispose ( ) ) )
99100 }
100101
101- private createWebviewPanel = ( column : number ) : vscode . WebviewPanel => {
102+ private createWebviewPanel = ( ) : vscode . WebviewPanel => {
102103 const viewType = 'CodeRoad'
103104 const title = 'CodeRoad'
104105 const config = {
@@ -109,7 +110,8 @@ class ReactWebView {
109110 // prevents destroying the window when it is in the background
110111 retainContextWhenHidden : true ,
111112 }
112- return vscode . window . createWebviewPanel ( viewType , title , column , config )
113+ this . loaded = true
114+ return vscode . window . createWebviewPanel ( viewType , title , vscode . ViewColumn . Two , config )
113115 }
114116
115117 private render = async ( ) : Promise < void > => {
0 commit comments