@@ -6,13 +6,13 @@ import { IQuickItemEx, leetCodeBinaryPath } from "../shared";
66import { executeCommand } from "../utils/cpUtils" ;
77import { DialogType , promptForOpenOutputChannel , promptForSignIn } from "../utils/uiUtils" ;
88
9- export async function getSessionList ( channel : vscode . OutputChannel ) : Promise < ISession [ ] > {
9+ export async function getSessionList ( ) : Promise < ISession [ ] > {
1010 const signInStatus : string | undefined = leetCodeManager . getUser ( ) ;
1111 if ( ! signInStatus ) {
1212 promptForSignIn ( ) ;
1313 return [ ] ;
1414 }
15- const result : string = await executeCommand ( channel , "node" , [ leetCodeBinaryPath , "session" ] ) ;
15+ const result : string = await executeCommand ( "node" , [ leetCodeBinaryPath , "session" ] ) ;
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 + % \) ) / ;
@@ -31,8 +31,8 @@ export async function getSessionList(channel: vscode.OutputChannel): Promise<ISe
3131 return sessions ;
3232}
3333
34- export async function selectSession ( channel : vscode . OutputChannel ) : Promise < void > {
35- const choice : IQuickItemEx < string > | undefined = await vscode . window . showQuickPick ( parseSessionsToPicks ( channel ) ) ;
34+ export async function selectSession ( ) : Promise < void > {
35+ const choice : IQuickItemEx < string > | undefined = await vscode . window . showQuickPick ( parseSessionsToPicks ( ) ) ;
3636 if ( ! choice || choice . description === "Active" ) {
3737 return ;
3838 }
@@ -41,18 +41,18 @@ export async function selectSession(channel: vscode.OutputChannel): Promise<void
4141 return ;
4242 }
4343 try {
44- await executeCommand ( channel , "node" , [ leetCodeBinaryPath , "session" , "-e" , choice . value ] ) ;
44+ await executeCommand ( "node" , [ leetCodeBinaryPath , "session" , "-e" , choice . value ] ) ;
4545 vscode . window . showInformationMessage ( `Successfully switched to session '${ choice . label } '.` ) ;
4646 await vscode . commands . executeCommand ( "leetcode.refreshExplorer" ) ;
4747 } catch ( error ) {
48- await promptForOpenOutputChannel ( "Failed to switch session. Please open the output channel for details." , DialogType . error , channel ) ;
48+ await promptForOpenOutputChannel ( "Failed to switch session. Please open the output channel for details." , DialogType . error ) ;
4949 }
5050}
5151
52- async function parseSessionsToPicks ( channel : vscode . OutputChannel ) : Promise < Array < IQuickItemEx < string > > > {
52+ async function parseSessionsToPicks ( ) : Promise < Array < IQuickItemEx < string > > > {
5353 return new Promise ( async ( resolve : ( res : Array < IQuickItemEx < string > > ) => void ) : Promise < void > => {
5454 try {
55- const sessions : ISession [ ] = await getSessionList ( channel ) ;
55+ const sessions : ISession [ ] = await getSessionList ( ) ;
5656 const picks : Array < IQuickItemEx < string > > = sessions . map ( ( s : ISession ) => Object . assign ( { } , {
5757 label : `${ s . active ? "$(check) " : "" } ${ s . name } ` ,
5858 description : s . active ? "Active" : "" ,
@@ -67,12 +67,12 @@ async function parseSessionsToPicks(channel: vscode.OutputChannel): Promise<Arra
6767 } ) ;
6868 resolve ( picks ) ;
6969 } catch ( error ) {
70- return await promptForOpenOutputChannel ( "Failed to list sessions. Please open the output channel for details." , DialogType . error , channel ) ;
70+ return await promptForOpenOutputChannel ( "Failed to list sessions. Please open the output channel for details." , DialogType . error ) ;
7171 }
7272 } ) ;
7373}
7474
75- export async function createSession ( channel : vscode . OutputChannel ) : Promise < void > {
75+ export async function createSession ( ) : Promise < void > {
7676 const session : string | undefined = await vscode . window . showInputBox ( {
7777 prompt : "Enter the new session name." ,
7878 validateInput : ( s : string ) : string | undefined => s && s . trim ( ) ? undefined : "Session name must not be empty" ,
@@ -81,10 +81,10 @@ export async function createSession(channel: vscode.OutputChannel): Promise<void
8181 return ;
8282 }
8383 try {
84- await executeCommand ( channel , "node" , [ leetCodeBinaryPath , "session" , "-c" , session ] ) ;
84+ await executeCommand ( "node" , [ leetCodeBinaryPath , "session" , "-c" , session ] ) ;
8585 vscode . window . showInformationMessage ( "New session created, you can switch to it by clicking the status bar." ) ;
8686 } catch ( error ) {
87- await promptForOpenOutputChannel ( "Failed to create session. Please open the output channel for details." , DialogType . error , channel ) ;
87+ await promptForOpenOutputChannel ( "Failed to create session. Please open the output channel for details." , DialogType . error ) ;
8888 }
8989}
9090
0 commit comments