@@ -24,7 +24,7 @@ import { Schemas } from 'vs/base/common/network';
2424import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace' ;
2525import { IConfigurationService } from 'vs/platform/configuration/common/configuration' ;
2626import { onUnexpectedError } from 'vs/base/common/errors' ;
27- import { URI , UriComponents } from 'vs/base/common/uri' ;
27+ import { URI } from 'vs/base/common/uri' ;
2828import { IWorkspaceInitializationPayload } from 'vs/platform/workspaces/common/workspaces' ;
2929import { WorkspaceService } from 'vs/workbench/services/configuration/browser/configurationService' ;
3030import { ConfigurationCache } from 'vs/workbench/services/configuration/browser/configurationCache' ;
@@ -34,21 +34,27 @@ import { ISignService } from 'vs/platform/sign/common/sign';
3434import { SignService } from 'vs/platform/sign/browser/signService' ;
3535import { hash } from 'vs/base/common/hash' ;
3636import { joinPath } from 'vs/base/common/resources' ;
37+ import { IWorkbenchConstructionOptions } from 'vs/workbench/workbench.web.api' ;
3738
3839interface IWindowConfiguration {
3940 remoteAuthority : string ;
4041
4142 userDataUri : URI ;
43+
44+ webviewEndpoint ?: string ;
45+
4246 folderUri ?: URI ;
4347 workspaceUri ?: URI ;
44- webviewEndpoint ?: string ;
4548}
4649
4750class CodeRendererMain extends Disposable {
4851
4952 private workbench : Workbench ;
5053
51- constructor ( private readonly configuration : IWindowConfiguration ) {
54+ constructor (
55+ private readonly domElement : HTMLElement ,
56+ private readonly configuration : IWindowConfiguration
57+ ) {
5258 super ( ) ;
5359 }
5460
@@ -60,7 +66,7 @@ class CodeRendererMain extends Disposable {
6066
6167 // Create Workbench
6268 this . workbench = new Workbench (
63- document . body ,
69+ this . domElement ,
6470 services . serviceCollection ,
6571 services . logService
6672 ) ;
@@ -186,23 +192,16 @@ class CodeRendererMain extends Disposable {
186192 }
187193}
188194
189- export interface IWindowConfigurationContents {
190- authority : string ;
191- userDataUri : UriComponents ;
192- folderUri ?: UriComponents ;
193- workspaceUri ?: UriComponents ;
194- webviewEndpoint ?: string ;
195- }
196-
197- export function main ( windowConfigurationContents : IWindowConfigurationContents ) : Promise < void > {
198- const windowConfiguration : IWindowConfiguration = {
199- userDataUri : URI . revive ( windowConfigurationContents . userDataUri ) ,
200- remoteAuthority : windowConfigurationContents . authority ,
201- folderUri : windowConfigurationContents . folderUri ? URI . revive ( windowConfigurationContents . folderUri ) : undefined ,
202- workspaceUri : windowConfigurationContents . workspaceUri ? URI . revive ( windowConfigurationContents . workspaceUri ) : undefined ,
203- webviewEndpoint : windowConfigurationContents . webviewEndpoint
204- } ;
195+ export function main ( domElement : HTMLElement , options : IWorkbenchConstructionOptions ) : Promise < void > {
196+ const renderer = new CodeRendererMain (
197+ domElement ,
198+ {
199+ userDataUri : URI . revive ( options . userDataUri ) ,
200+ remoteAuthority : options . remoteAuthority ,
201+ webviewEndpoint : options . webviewEndpoint ,
202+ folderUri : options . folderUri ? URI . revive ( options . folderUri ) : undefined ,
203+ workspaceUri : options . workspaceUri ? URI . revive ( options . workspaceUri ) : undefined ,
204+ } ) ;
205205
206- const renderer = new CodeRendererMain ( windowConfiguration ) ;
207206 return renderer . open ( ) ;
208207}
0 commit comments