File tree 3 files changed +27
-0
lines changed 3 files changed +27
-0
lines changed Original file line number Diff line number Diff line change 33
33
" onCommand:leetcode.createSession" ,
34
34
" onCommand:leetcode.refreshExplorer" ,
35
35
" onCommand:leetcode.showProblem" ,
36
+ " onCommand:leetcode.loadAllProblems" ,
36
37
" onCommand:leetcode.searchProblem" ,
37
38
" onCommand:leetcode.testSolution" ,
38
39
" onCommand:leetcode.submitSolution" ,
93
94
"title" : " Show Problem" ,
94
95
"category" : " LeetCode"
95
96
},
97
+ {
98
+ "command" : " leetcode.loadAllProblems" ,
99
+ "title" : " Load All Problems" ,
100
+ "category" : " LeetCode"
101
+ },
96
102
{
97
103
"command" : " leetcode.searchProblem" ,
98
104
"title" : " Search Problem" ,
158
164
"command" : " leetcode.showProblem" ,
159
165
"when" : " view == leetCodeExplorer && viewItem == problem" ,
160
166
"group" : " leetcode@1"
167
+ },
168
+ {
169
+ "command" : " leetcode.loadAllProblems" ,
170
+ "when" : " view == leetCodeExplorer && viewItem == problem" ,
171
+ "group" : " leetcode@1"
161
172
}
162
173
],
163
174
"commandPalette" : [
Original file line number Diff line number Diff line change @@ -21,6 +21,14 @@ export async function showProblem(node?: LeetCodeNode): Promise<void> {
21
21
await showProblemInternal ( node ) ;
22
22
}
23
23
24
+ export async function loadAllProblems ( ) : Promise < void > {
25
+ if ( ! leetCodeManager . getUser ( ) ) {
26
+ promptForSignIn ( ) ;
27
+ return ;
28
+ }
29
+ await loadAllProblemsInternal ( ) ;
30
+ }
31
+
24
32
export async function searchProblem ( ) : Promise < void > {
25
33
if ( ! leetCodeManager . getUser ( ) ) {
26
34
promptForSignIn ( ) ;
@@ -39,7 +47,14 @@ export async function searchProblem(): Promise<void> {
39
47
await showProblemInternal ( choice . value ) ;
40
48
}
41
49
50
+ async function loadAllProblemsInternal ( ) {
51
+ new Promise ( async ( resolve : ( res : Array < IQuickItemEx < IProblem > > ) => void ) : Promise < void > => {
52
+ ( await list . listProblems ( ) ) . map ( ( problem : IProblem ) => showProblemInternal ( problem ) ) ;
53
+ } ) ;
54
+ }
55
+
42
56
async function showProblemInternal ( node : IProblem ) : Promise < void > {
57
+ console . log ( node . id + " " + node . name )
43
58
try {
44
59
const leetCodeConfig : vscode . WorkspaceConfiguration = vscode . workspace . getConfiguration ( "leetcode" ) ;
45
60
let defaultLanguage : string | undefined = leetCodeConfig . get < string > ( "defaultLanguage" ) ;
Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
43
43
vscode . commands . registerCommand ( "leetcode.selectSessions" , ( ) => session . selectSession ( ) ) ,
44
44
vscode . commands . registerCommand ( "leetcode.createSession" , ( ) => session . createSession ( ) ) ,
45
45
vscode . commands . registerCommand ( "leetcode.showProblem" , ( node : LeetCodeNode ) => show . showProblem ( node ) ) ,
46
+ vscode . commands . registerCommand ( "leetcode.loadAllProblems" , ( node : LeetCodeNode ) => show . loadAllProblems ( ) ) ,
46
47
vscode . commands . registerCommand ( "leetcode.searchProblem" , ( ) => show . searchProblem ( ) ) ,
47
48
vscode . commands . registerCommand ( "leetcode.refreshExplorer" , ( ) => leetCodeTreeDataProvider . refresh ( ) ) ,
48
49
vscode . commands . registerCommand ( "leetcode.testSolution" , ( uri ?: vscode . Uri ) => test . testSolution ( uri ) ) ,
You can’t perform that action at this time.
0 commit comments