@@ -99,6 +99,8 @@ const packageJson = vscode.extensions.getExtension(extensionId).packageJSON;
99
99
const extensionVersion = packageJson . version ;
100
100
const aiKey = packageJson . aiKey ;
101
101
102
+ const _onDidChangeConnection = new vscode . EventEmitter < void > ( ) ;
103
+
102
104
export const config = ( setting ?: string , workspaceFolderName ?: string ) : vscode . WorkspaceConfiguration | any => {
103
105
workspaceFolderName = workspaceFolderName || currentWorkspaceFolder ( ) ;
104
106
if (
@@ -192,6 +194,7 @@ export async function checkConnection(clearCookies = false, uri?: vscode.Uri): P
192
194
workspaceState . update ( configName + ":password" , undefined ) ;
193
195
workspaceState . update ( configName + ":apiVersion" , undefined ) ;
194
196
workspaceState . update ( configName + ":docker" , undefined ) ;
197
+ _onDidChangeConnection . fire ( ) ;
195
198
}
196
199
let api = new AtelierAPI ( apiTarget , false ) ;
197
200
const { active, host = "" , port = 0 , ns = "" } = api . config ;
@@ -224,6 +227,7 @@ export async function checkConnection(clearCookies = false, uri?: vscode.Uri): P
224
227
workspaceState . update ( configName + ":port" , dockerPort ) ;
225
228
}
226
229
connInfo = `localhost:${ dockerPort } [${ ns } ]` ;
230
+ _onDidChangeConnection . fire ( ) ;
227
231
}
228
232
} catch ( error ) {
229
233
outputChannel . appendError ( error ) ;
@@ -279,6 +283,7 @@ export async function checkConnection(clearCookies = false, uri?: vscode.Uri): P
279
283
async ( password ) => {
280
284
if ( password ) {
281
285
workspaceState . update ( configName + ":password" , password ) ;
286
+ _onDidChangeConnection . fire ( ) ;
282
287
await checkConnection ( false , uri ) ;
283
288
} else if ( ! api . externalServer ) {
284
289
disableConnection ( configName ) ;
@@ -823,6 +828,9 @@ export async function activate(context: vscode.ExtensionContext): Promise<any> {
823
828
}
824
829
return uri ;
825
830
} ,
831
+ onDidChangeConnection ( ) : vscode . Event < void > {
832
+ return _onDidChangeConnection . event ;
833
+ } ,
826
834
} ;
827
835
828
836
// 'export' our public API
0 commit comments