@@ -5,8 +5,7 @@ import '../../common/extensions';
55
66import * as fs from 'fs-extra' ;
77import * as path from 'path' ;
8- import { Uri , ViewColumn , WebviewPanel , window } from 'vscode' ;
9-
8+ import { Uri , ViewColumn , Webview , WebviewPanel , window } from 'vscode' ;
109import * as localize from '../../common/utils/localize' ;
1110import { Identifiers } from '../../datascience/constants' ;
1211import { IServiceContainer } from '../../ioc/types' ;
@@ -89,7 +88,7 @@ export class WebPanel implements IWebPanel {
8988
9089 // Call our special function that sticks this script inside of an html page
9190 // and translates all of the paths to vscode-resource URIs
92- this . panel . webview . html = this . generateReactHtml ( mainScriptPath , embeddedCss , settings ) ;
91+ this . panel . webview . html = this . generateReactHtml ( mainScriptPath , this . panel . webview , embeddedCss , settings ) ;
9392
9493 // Reset when the current panel is closed
9594 this . disposableRegistry . push ( this . panel . onDidDispose ( ( ) => {
@@ -118,11 +117,9 @@ export class WebPanel implements IWebPanel {
118117 }
119118
120119 // tslint:disable-next-line:no-any
121- private generateReactHtml ( mainScriptPath : string , embeddedCss ?: string , settings ?: any ) {
122- const uriBasePath = Uri . file ( `${ path . dirname ( mainScriptPath ) } /` ) ;
123- const uriPath = Uri . file ( mainScriptPath ) ;
124- const uriBase = uriBasePath . with ( { scheme : 'vscode-resource' } ) ;
125- const uri = uriPath . with ( { scheme : 'vscode-resource' } ) ;
120+ private generateReactHtml ( mainScriptPath : string , webView : Webview , embeddedCss ?: string , settings ?: any ) {
121+ const uriBase = webView . asWebviewUri ( Uri . file ( `${ path . dirname ( mainScriptPath ) } /` ) ) ;
122+ const uri = webView . asWebviewUri ( Uri . file ( mainScriptPath ) ) ;
126123 const locDatabase = localize . getCollectionJSON ( ) ;
127124 const style = embeddedCss ? embeddedCss : '' ;
128125 const settingsString = settings ? JSON . stringify ( settings ) : '{}' ;
0 commit comments