File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change 8787 },
8888 {
8989 "command" : " zenstack.clear-documentation-cache"
90+ },
91+ {
92+ "command" : " zenstack.logout"
9093 }
9194 ]
9295 },
100103 "command" : " zenstack.clear-documentation-cache" ,
101104 "title" : " ZenStack: Clear Documentation Cache" ,
102105 "icon" : " $(trash)"
106+ },
107+ {
108+ "command" : " zenstack.logout" ,
109+ "title" : " ZenStack: Logout" ,
110+ "icon" : " $(log-out)"
103111 }
104112 ],
105113 "keybindings" : [
Original file line number Diff line number Diff line change @@ -37,6 +37,10 @@ export class ZenStackAuthenticationProvider implements vscode.AuthenticationProv
3737 await this . handleAuthCallback ( uri ) ;
3838 }
3939 } ,
40+ } ) ,
41+ // Register logout command
42+ vscode . commands . registerCommand ( 'zenstack.logout' , async ( ) => {
43+ await this . logoutAllSessions ( ) ;
4044 } )
4145 ) ;
4246 }
@@ -77,6 +81,18 @@ export class ZenStackAuthenticationProvider implements vscode.AuthenticationProv
7781 }
7882 }
7983
84+ /**
85+ * Log out all sessions
86+ */
87+ async logoutAllSessions ( ) : Promise < void > {
88+ if ( this . _sessions . length === 0 ) {
89+ return ;
90+ }
91+
92+ ( await this . getSessions ( ) ) . forEach ( async ( s ) => await this . removeSession ( s . id ) ) ;
93+ vscode . window . showInformationMessage ( 'Successfully logged out of ZenStack.' ) ;
94+ }
95+
8096 private async performLogin ( scopes : readonly string [ ] ) : Promise < vscode . AuthenticationSession > {
8197 // Create the authentication promise
8298 return vscode . window . withProgress (
You can’t perform that action at this time.
0 commit comments