@@ -16,11 +16,11 @@ export async function getSessionList(): Promise<ISession[]> {
16
16
const lines : string [ ] = result . split ( "\n" ) ;
17
17
const sessions : ISession [ ] = [ ] ;
18
18
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 ) {
20
20
const match : RegExpMatchArray | null = line . match ( reg ) ;
21
21
if ( match && match . length === 6 ) {
22
22
sessions . push ( {
23
- active : ! ! match [ 1 ] ,
23
+ active : ! ! ( match [ 1 ] . trim ( ) ) ,
24
24
id : match [ 2 ] . trim ( ) ,
25
25
name : match [ 3 ] . trim ( ) ,
26
26
acQuestions : match [ 4 ] . trim ( ) ,
@@ -43,6 +43,7 @@ export async function selectSession(): Promise<void> {
43
43
try {
44
44
await cp . executeCommand ( "node" , [ leetCodeBinaryPath , "session" , "-e" , choice . value ] ) ;
45
45
vscode . window . showInformationMessage ( `Successfully switched to session '${ choice . label } '.` ) ;
46
+ await vscode . commands . executeCommand ( "leetcode.refreshExplorer" ) ;
46
47
} catch ( error ) {
47
48
await promptForOpenOutputChannel ( "Failed to switch session. Please open the output channel for details" , DialogType . error ) ;
48
49
}
@@ -59,6 +60,7 @@ async function parseSessionsToPicks(p: Promise<ISession[]>): Promise<Array<IQuic
59
60
picks . push ( {
60
61
label : "$(plus) Create a new session" ,
61
62
description : "" ,
63
+ detail : "Click this item to create a new session" ,
62
64
value : ":createNewSession" ,
63
65
} ) ;
64
66
resolve ( picks ) ;
@@ -75,6 +77,7 @@ export async function createSession(): Promise<void> {
75
77
}
76
78
try {
77
79
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." ) ;
78
81
} catch ( error ) {
79
82
await promptForOpenOutputChannel ( "Failed to create session. Please open the output channel for details" , DialogType . error ) ;
80
83
}
0 commit comments