@@ -250,6 +250,9 @@ export async function resolveConnectionSpec(serverName: string, uri?: vscode.Uri
250
250
port : serverForUri . port ,
251
251
pathPrefix : serverForUri . pathPrefix ,
252
252
} ,
253
+ superServer : {
254
+ port : serverForUri . superserverPort ,
255
+ } ,
253
256
username : serverForUri . username ,
254
257
password : serverForUri . password ? serverForUri . password : undefined ,
255
258
description : `Server for workspace folder '${ serverName } '` ,
@@ -330,14 +333,15 @@ export async function checkConnection(
330
333
/// clean-up cached values
331
334
await workspaceState . update ( wsKey + ":host" , undefined ) ;
332
335
await workspaceState . update ( wsKey + ":port" , undefined ) ;
336
+ await workspaceState . update ( wsKey + ":superserverPort" , undefined ) ;
333
337
await workspaceState . update ( wsKey + ":password" , undefined ) ;
334
338
await workspaceState . update ( wsKey + ":apiVersion" , undefined ) ;
335
339
await workspaceState . update ( wsKey + ":serverVersion" , undefined ) ;
336
340
await workspaceState . update ( wsKey + ":docker" , undefined ) ;
337
341
_onDidChangeConnection . fire ( ) ;
338
342
}
339
343
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 ;
341
345
vscode . commands . executeCommand ( "setContext" , "vscode-objectscript.connectActive" , active ) ;
342
346
if ( ! panel . text ) {
343
347
panel . text = `${ PANEL_LABEL } ` ;
@@ -360,11 +364,16 @@ export async function checkConnection(
360
364
361
365
if ( ! workspaceState . get ( wsKey + ":port" ) && ! api . externalServer ) {
362
366
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 ) ;
364
373
workspaceState . update ( wsKey + ":docker" , withDocker ) ;
365
374
workspaceState . update ( wsKey + ":dockerService" , service ) ;
366
375
if ( withDocker ) {
367
- if ( ! dockerPort ) {
376
+ if ( ! dockerPort || ! dockerSuperserverPort ) {
368
377
const errorMessage = `Something is wrong with your docker-compose connection settings, or your service is not running.` ;
369
378
handleError ( errorMessage ) ;
370
379
panel . text = `${ PANEL_LABEL } $(error)` ;
@@ -377,6 +386,9 @@ export async function checkConnection(
377
386
workspaceState . update ( wsKey + ":host" , "localhost" ) ;
378
387
workspaceState . update ( wsKey + ":port" , dockerPort ) ;
379
388
}
389
+ if ( dockerSuperserverPort !== superserverPort ) {
390
+ workspaceState . update ( wsKey + ":superserverPort" , dockerSuperserverPort ) ;
391
+ }
380
392
connInfo = `localhost:${ dockerPort } [${ ns } ]` ;
381
393
_onDidChangeConnection . fire ( ) ;
382
394
}
@@ -1627,6 +1639,7 @@ function serverForUri(uri: vscode.Uri): any {
1627
1639
host = "" ,
1628
1640
https,
1629
1641
port,
1642
+ superserverPort,
1630
1643
pathPrefix,
1631
1644
username,
1632
1645
password,
@@ -1640,6 +1653,7 @@ function serverForUri(uri: vscode.Uri): any {
1640
1653
scheme : https ? "https" : "http" ,
1641
1654
host,
1642
1655
port,
1656
+ superserverPort,
1643
1657
pathPrefix,
1644
1658
username,
1645
1659
password :
@@ -1661,9 +1675,14 @@ async function asyncServerForUri(uri: vscode.Uri): Promise<any> {
1661
1675
if ( apiTarget instanceof vscode . Uri ) {
1662
1676
apiTarget = vscode . workspace . getWorkspaceFolder ( apiTarget ) ?. name ;
1663
1677
}
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 ) {
1666
1684
server . port = dockerPort ;
1685
+ server . superserverPort = dockerSuperserverPort ;
1667
1686
server . host = "localhost" ;
1668
1687
server . pathPrefix = "" ;
1669
1688
server . https = false ;
0 commit comments