@@ -16,6 +16,11 @@ import { NamespaceTreeItem, ProjectTreeItem, ServerManagerView, ServerTreeItem,
1616export const extensionId = "intersystems-community.servermanager" ;
1717export let globalState : vscode . Memento ;
1818
19+ export function getAccountFromParts ( serverName : string , userName ?: string ) : vscode . AuthenticationSessionAccountInformation | undefined {
20+ const accountId = userName ? `${ serverName } /${ userName . toLowerCase ( ) } ` : undefined ;
21+ return accountId ? { id : accountId , label : `${ userName } on ${ serverName } ` } : undefined ;
22+ }
23+
1924export function activate ( context : vscode . ExtensionContext ) {
2025
2126 const _onDidChangePassword = new vscode . EventEmitter < string > ( ) ;
@@ -43,10 +48,11 @@ export function activate(context: vscode.ExtensionContext) {
4348
4449 // Still logged in with the authentication provider?
4550 const scopes = [ serverSession . serverName , serverSession . username . toLowerCase ( ) ] ;
51+ const account = getAccountFromParts ( serverSession . serverName , serverSession . username ) ;
4652 const session = await vscode . authentication . getSession (
4753 AUTHENTICATION_PROVIDER ,
4854 scopes ,
49- { silent : true } ,
55+ { silent : true , account } ,
5056 ) ;
5157
5258 // If not, try to log out on the server, then remove our record of its cookies
@@ -407,6 +413,10 @@ export function activate(context: vscode.ExtensionContext) {
407413 return spec ;
408414 } ,
409415
416+ getAccount ( serverSpec : IServerSpec ) : vscode . AuthenticationSessionAccountInformation | undefined {
417+ return getAccountFromParts ( serverSpec . name , serverSpec . username ) ;
418+ } ,
419+
410420 onDidChangePassword (
411421 ) : vscode . Event < string > {
412422 return _onDidChangePassword . event ;
0 commit comments