1- import * as vscode from " vscode" ;
2- import * as path from " path" ;
3- import { log } from " ./utils/Logger" ;
1+ import * as vscode from ' vscode'
2+ import * as path from ' path'
3+ import { log } from ' ./utils/Logger'
44
55export class DevtoolsPanel {
6- public static currentPanel : DevtoolsPanel | undefined ;
6+ public static currentPanel : DevtoolsPanel | undefined
77
8- public static viewType = " overmindDevtools" ;
8+ public static viewType = ' overmindDevtools'
99
1010 // keeps track of location for overmind-devetools js bundle
11- public static scriptFile : any = null ;
11+ public static scriptFile : any = null
1212
13- private readonly _panel : vscode . WebviewPanel ;
13+ private readonly _panel : vscode . WebviewPanel
1414
15- private _disposables : vscode . Disposable [ ] = [ ] ;
15+ private _disposables : vscode . Disposable [ ] = [ ]
1616
1717 private constructor ( panel : vscode . WebviewPanel , extensionPath : string ) {
18- this . _panel = panel ;
19- this . update ( ) ;
18+ this . _panel = panel
19+ this . update ( )
2020
21- this . _panel . onDidDispose ( ( ) => this . dispose ( ) , null , this . _disposables ) ;
21+ this . _panel . onDidDispose ( ( ) => this . dispose ( ) , null , this . _disposables )
2222
2323 this . _panel . onDidChangeViewState (
24- e => {
24+ ( e ) => {
2525 if ( this . _panel . visible ) {
26- this . update ( ) ;
26+ this . update ( )
2727 }
2828 } ,
2929 null ,
3030 this . _disposables
31- ) ;
31+ )
3232
3333 this . _panel . webview . onDidReceiveMessage (
34- message => {
34+ ( message ) => {
3535 switch ( message . command ) {
36- case "alert" :
37- vscode . window . showErrorMessage ( message . text ) ;
38-
36+ case 'alert' :
37+ vscode . window . showErrorMessage ( message . text )
3938 }
4039 } ,
4140 null ,
4241 this . _disposables
43- ) ;
42+ )
4443 }
4544
4645 dispose ( ) : any {
47- DevtoolsPanel . currentPanel = undefined ;
48- this . _panel . dispose ( ) ;
46+ DevtoolsPanel . currentPanel = undefined
47+ this . _panel . dispose ( )
4948 while ( this . _disposables . length ) {
50- const x = this . _disposables . pop ( ) ;
49+ const x = this . _disposables . pop ( )
5150 if ( x ) {
52- x . dispose ( ) ;
51+ x . dispose ( )
5352 }
5453 }
5554 }
5655
5756 private update ( ) {
58- log ( " Extension.update" ) ;
59- this . _panel . webview . html = this . getHtmlForWevbiew ( ) ;
57+ log ( ' Extension.update' )
58+ this . _panel . webview . html = this . getHtmlForWevbiew ( )
6059 }
6160
6261 private getHtmlForWevbiew ( ) : string {
@@ -77,38 +76,38 @@ export class DevtoolsPanel {
7776 />
7877 </head>
7978 <body>
80- <script type="text/javascript" src="${ DevtoolsPanel . scriptFile } "></script>
79+ <script type="text/javascript" src="http://localhost:8080/bundle.js "></script>
8180 </body>
8281 </html>
83- ` ;
82+ `
8483 }
8584
8685 static createOrShow ( extensionPath : string ) {
8786 const column = vscode . window . activeTextEditor
8887 ? vscode . window . activeTextEditor . viewColumn
89- : undefined ;
88+ : undefined
9089
9190 if ( DevtoolsPanel . currentPanel ) {
92- DevtoolsPanel . currentPanel . _panel . reveal ( column ) ;
93- return ;
91+ DevtoolsPanel . currentPanel . _panel . reveal ( column )
92+ return
9493 }
9594 const panel = vscode . window . createWebviewPanel (
9695 DevtoolsPanel . viewType ,
97- " Overmind" ,
96+ ' Overmind' ,
9897 column || vscode . ViewColumn . One ,
9998 {
10099 enableScripts : true ,
101100 retainContextWhenHidden : true ,
102101 localResourceRoots : [
103- vscode . Uri . file ( path . join ( extensionPath , " devtoolsDist" ) )
104- ]
102+ vscode . Uri . file ( path . join ( extensionPath , ' devtoolsDist' ) ) ,
103+ ] ,
105104 }
106- ) ;
105+ )
107106
108- DevtoolsPanel . currentPanel = new DevtoolsPanel ( panel , extensionPath ) ;
107+ DevtoolsPanel . currentPanel = new DevtoolsPanel ( panel , extensionPath )
109108 }
110109
111110 static revive ( webViewPanel : vscode . WebviewPanel , extensionPath : string ) {
112- DevtoolsPanel . currentPanel = new DevtoolsPanel ( webViewPanel , extensionPath ) ;
111+ DevtoolsPanel . currentPanel = new DevtoolsPanel ( webViewPanel , extensionPath )
113112 }
114113}
0 commit comments