@@ -250,6 +250,9 @@ export async function resolveConnectionSpec(serverName: string, uri?: vscode.Uri
250250 port : serverForUri . port ,
251251 pathPrefix : serverForUri . pathPrefix ,
252252 } ,
253+ superServer : {
254+ port : serverForUri . superserverPort ,
255+ } ,
253256 username : serverForUri . username ,
254257 password : serverForUri . password ? serverForUri . password : undefined ,
255258 description : `Server for workspace folder '${ serverName } '` ,
@@ -330,14 +333,15 @@ export async function checkConnection(
330333 /// clean-up cached values
331334 await workspaceState . update ( wsKey + ":host" , undefined ) ;
332335 await workspaceState . update ( wsKey + ":port" , undefined ) ;
336+ await workspaceState . update ( wsKey + ":superserverPort" , undefined ) ;
333337 await workspaceState . update ( wsKey + ":password" , undefined ) ;
334338 await workspaceState . update ( wsKey + ":apiVersion" , undefined ) ;
335339 await workspaceState . update ( wsKey + ":serverVersion" , undefined ) ;
336340 await workspaceState . update ( wsKey + ":docker" , undefined ) ;
337341 _onDidChangeConnection . fire ( ) ;
338342 }
339343 let api = new AtelierAPI ( apiTarget , false ) ;
340- const { active, host = "" , port = 0 , username, ns = "" } = api . config ;
344+ const { active, host = "" , port = 0 , superserverPort = 0 , username, ns = "" } = api . config ;
341345 vscode . commands . executeCommand ( "setContext" , "vscode-objectscript.connectActive" , active ) ;
342346 if ( ! panel . text ) {
343347 panel . text = `${ PANEL_LABEL } ` ;
@@ -360,11 +364,16 @@ export async function checkConnection(
360364
361365 if ( ! workspaceState . get ( wsKey + ":port" ) && ! api . externalServer ) {
362366 try {
363- const { port : dockerPort , docker : withDocker , service } = await portFromDockerCompose ( ) ;
367+ const {
368+ port : dockerPort ,
369+ superserverPort : dockerSuperserverPort ,
370+ docker : withDocker ,
371+ service,
372+ } = await portFromDockerCompose ( configName ) ;
364373 workspaceState . update ( wsKey + ":docker" , withDocker ) ;
365374 workspaceState . update ( wsKey + ":dockerService" , service ) ;
366375 if ( withDocker ) {
367- if ( ! dockerPort ) {
376+ if ( ! dockerPort || ! dockerSuperserverPort ) {
368377 const errorMessage = `Something is wrong with your docker-compose connection settings, or your service is not running.` ;
369378 handleError ( errorMessage ) ;
370379 panel . text = `${ PANEL_LABEL } $(error)` ;
@@ -377,6 +386,9 @@ export async function checkConnection(
377386 workspaceState . update ( wsKey + ":host" , "localhost" ) ;
378387 workspaceState . update ( wsKey + ":port" , dockerPort ) ;
379388 }
389+ if ( dockerSuperserverPort !== superserverPort ) {
390+ workspaceState . update ( wsKey + ":superserverPort" , dockerSuperserverPort ) ;
391+ }
380392 connInfo = `localhost:${ dockerPort } [${ ns } ]` ;
381393 _onDidChangeConnection . fire ( ) ;
382394 }
@@ -1627,6 +1639,7 @@ function serverForUri(uri: vscode.Uri): any {
16271639 host = "" ,
16281640 https,
16291641 port,
1642+ superserverPort,
16301643 pathPrefix,
16311644 username,
16321645 password,
@@ -1640,6 +1653,7 @@ function serverForUri(uri: vscode.Uri): any {
16401653 scheme : https ? "https" : "http" ,
16411654 host,
16421655 port,
1656+ superserverPort,
16431657 pathPrefix,
16441658 username,
16451659 password :
@@ -1661,9 +1675,14 @@ async function asyncServerForUri(uri: vscode.Uri): Promise<any> {
16611675 if ( apiTarget instanceof vscode . Uri ) {
16621676 apiTarget = vscode . workspace . getWorkspaceFolder ( apiTarget ) ?. name ;
16631677 }
1664- const { port : dockerPort , docker : withDocker } = await portFromDockerCompose ( apiTarget ) ;
1665- if ( withDocker && dockerPort ) {
1678+ const {
1679+ port : dockerPort ,
1680+ superserverPort : dockerSuperserverPort ,
1681+ docker : withDocker ,
1682+ } = await portFromDockerCompose ( apiTarget ) ;
1683+ if ( withDocker && dockerPort && dockerSuperserverPort ) {
16661684 server . port = dockerPort ;
1685+ server . superserverPort = dockerSuperserverPort ;
16671686 server . host = "localhost" ;
16681687 server . pathPrefix = "" ;
16691688 server . https = false ;
0 commit comments