File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -181,6 +181,7 @@ export class ServerManagerAuthenticationProvider implements AuthenticationProvid
181181 this . _sessions [ index ] = session ;
182182 changed . push ( session ) ;
183183 } else {
184+ // No point re-sorting here because onDidChangeSessions always appends added items to the provider's entries in the Accounts menu
184185 this . _sessions . push ( session ) ;
185186 added . push ( session ) ;
186187 }
@@ -278,7 +279,20 @@ export class ServerManagerAuthenticationProvider implements AuthenticationProvid
278279 const accessToken = await this . _secretStorage . get ( credentialKey ) ;
279280 return new ServerManagerAuthenticationSession ( session . serverName , session . userName , accessToken ) ;
280281 } ) ,
281- ) ) . filter ( ( session ) => session . accessToken ) ;
282+ ) ) . filter ( ( session ) => session . accessToken ) . sort ( ( a , b ) => {
283+ const aUserNameLowercase = a . userName . toLowerCase ( ) ;
284+ const bUserNameLowercase = b . userName . toLowerCase ( ) ;
285+ if ( aUserNameLowercase < bUserNameLowercase ) {
286+ return - 1 ;
287+ }
288+ if ( aUserNameLowercase > bUserNameLowercase ) {
289+ return 1 ;
290+ }
291+ if ( a . serverName < b . serverName ) {
292+ return - 1 ;
293+ }
294+ return 1 ;
295+ } ) ;
282296 }
283297
284298 private async _storeStrippedSessions ( ) {
You can’t perform that action at this time.
0 commit comments