@@ -16,11 +16,11 @@ export async function getSessionList(): Promise<ISession[]> {
1616 const lines : string [ ] = result . split ( "\n" ) ;
1717 const sessions : ISession [ ] = [ ] ;
1818 const reg : RegExp = / ( .? ) \s * ( \d + ) \s + ( .* ) \s + ( \d + \( \s * \d + \. \d + % \) ) \s + ( \d + \( \s * \d + \. \d + % \) ) / ;
19- for ( const line of lines . map ( ( l : string ) => l . trim ( ) ) . filter ( Boolean ) ) {
19+ for ( const line of lines ) {
2020 const match : RegExpMatchArray | null = line . match ( reg ) ;
2121 if ( match && match . length === 6 ) {
2222 sessions . push ( {
23- active : ! ! match [ 1 ] ,
23+ active : ! ! ( match [ 1 ] . trim ( ) ) ,
2424 id : match [ 2 ] . trim ( ) ,
2525 name : match [ 3 ] . trim ( ) ,
2626 acQuestions : match [ 4 ] . trim ( ) ,
@@ -43,6 +43,7 @@ export async function selectSession(): Promise<void> {
4343 try {
4444 await cp . executeCommand ( "node" , [ leetCodeBinaryPath , "session" , "-e" , choice . value ] ) ;
4545 vscode . window . showInformationMessage ( `Successfully switched to session '${ choice . label } '.` ) ;
46+ await vscode . commands . executeCommand ( "leetcode.refreshExplorer" ) ;
4647 } catch ( error ) {
4748 await promptForOpenOutputChannel ( "Failed to switch session. Please open the output channel for details" , DialogType . error ) ;
4849 }
@@ -59,6 +60,7 @@ async function parseSessionsToPicks(p: Promise<ISession[]>): Promise<Array<IQuic
5960 picks . push ( {
6061 label : "$(plus) Create a new session" ,
6162 description : "" ,
63+ detail : "Click this item to create a new session" ,
6264 value : ":createNewSession" ,
6365 } ) ;
6466 resolve ( picks ) ;
@@ -75,6 +77,7 @@ export async function createSession(): Promise<void> {
7577 }
7678 try {
7779 await cp . executeCommand ( "node" , [ leetCodeBinaryPath , "session" , "-c" , session ] ) ;
80+ vscode . window . showInformationMessage ( "New session created, you can switch to it by clicking the status bar." ) ;
7881 } catch ( error ) {
7982 await promptForOpenOutputChannel ( "Failed to create session. Please open the output channel for details" , DialogType . error ) ;
8083 }
0 commit comments