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
181
181
this . _sessions [ index ] = session ;
182
182
changed . push ( session ) ;
183
183
} else {
184
+ // No point re-sorting here because onDidChangeSessions always appends added items to the provider's entries in the Accounts menu
184
185
this . _sessions . push ( session ) ;
185
186
added . push ( session ) ;
186
187
}
@@ -278,7 +279,20 @@ export class ServerManagerAuthenticationProvider implements AuthenticationProvid
278
279
const accessToken = await this . _secretStorage . get ( credentialKey ) ;
279
280
return new ServerManagerAuthenticationSession ( session . serverName , session . userName , accessToken ) ;
280
281
} ) ,
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
+ } ) ;
282
296
}
283
297
284
298
private async _storeStrippedSessions ( ) {
You can’t perform that action at this time.
0 commit comments