Skip to content

Commit f6d9a75

Browse files
committed
update
1 parent f8ac5ad commit f6d9a75

17 files changed

+837
-355
lines changed

package.json

Lines changed: 75 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -27,95 +27,100 @@
2727
],
2828
"preview": true,
2929
"activationEvents": [
30-
"onCommand:leetcode.toggleLeetCodeCn",
31-
"onCommand:leetcode.signin",
32-
"onCommand:leetcode.signout",
33-
"onCommand:leetcode.refreshExplorer",
34-
"onCommand:leetcode.pickOne",
35-
"onCommand:leetcode.deleteAllCache",
36-
"onCommand:leetcode.showProblem",
37-
"onCommand:leetcode.previewProblem",
38-
"onCommand:leetcode.searchProblem",
39-
"onCommand:leetcode.testSolution",
40-
"onCommand:leetcode.submitSolution",
41-
"onCommand:leetcode.switchDefaultLanguage",
42-
"onCommand:leetcode.problems.sort",
30+
"onCommand:lcpr.toggleLeetCodeCn",
31+
"onCommand:lcpr.signin",
32+
"onCommand:lcpr.signout",
33+
"onCommand:lcpr.refreshExplorer",
34+
"onCommand:lcpr.pickOne",
35+
"onCommand:lcpr.deleteAllCache",
36+
"onCommand:lcpr.showProblem",
37+
"onCommand:lcpr.previewProblem",
38+
"onCommand:lcpr.searchProblem",
39+
"onCommand:lcpr.testSolution",
40+
"onCommand:lcpr.submitSolution",
41+
"onCommand:lcpr.setDefaultLanguage",
42+
"onCommand:lcpr.problems.sort",
4343
"onView:QuestionExplorer"
4444
],
4545
"main": "./out/src/extension",
4646
"contributes": {
4747
"commands": [
4848
{
49-
"command": "leetcode.deleteCache",
49+
"command": "lcpr.deleteCache",
5050
"title": "Delete Cache",
5151
"category": "LeetCode"
5252
},
5353
{
54-
"command": "leetcode.toggleLeetCodeCn",
54+
"command": "lcpr.toggleLeetCodeCn",
5555
"title": "Switch Endpoint",
5656
"category": "LeetCode",
5757
"icon": "$(globe)"
5858
},
5959
{
60-
"command": "leetcode.signin",
60+
"command": "lcpr.signin",
6161
"title": "Sign In",
6262
"category": "LeetCode",
6363
"icon": "$(sign-in)"
6464
},
6565
{
66-
"command": "leetcode.signout",
66+
"command": "lcpr.signout",
6767
"title": "Sign Out",
6868
"category": "LeetCode"
6969
},
7070
{
71-
"command": "leetcode.refreshExplorer",
71+
"command": "lcpr.refreshExplorer",
7272
"title": "Refresh",
7373
"category": "LeetCode",
7474
"icon": "$(refresh)"
7575
},
7676
{
77-
"command": "leetcode.pickOne",
77+
"command": "lcpr.pickOne",
7878
"title": "Pick One",
7979
"category": "LeetCode"
8080
},
8181
{
82-
"command": "leetcode.deleteAllCache",
82+
"command": "lcpr.deleteAllCache",
8383
"title": "deleteAllCache",
8484
"category": "LeetCode"
8585
},
8686
{
87-
"command": "leetcode.showProblem",
87+
"command": "lcpr.showProblem",
8888
"title": "Show Problem",
8989
"category": "LeetCode"
9090
},
9191
{
92-
"command": "leetcode.previewProblem",
92+
"command": "lcpr.previewProblem",
9393
"title": "Preview Problem",
9494
"category": "LeetCode"
9595
},
9696
{
97-
"command": "leetcode.searchProblem",
97+
"command": "lcpr.SetBricksType",
98+
"title": "设置提交几天后出现在工地",
99+
"category": "LeetCode"
100+
},
101+
{
102+
"command": "lcpr.searchProblem",
98103
"title": "Search Problem",
99104
"category": "LeetCode",
100105
"icon": "$(search)"
101106
},
102107
{
103-
"command": "leetcode.showSolution",
108+
"command": "lcpr.showSolution",
104109
"title": "Show Top Voted Solution",
105110
"category": "LeetCode"
106111
},
107112
{
108-
"command": "leetcode.testSolution",
113+
"command": "lcpr.testSolution",
109114
"title": "Test in LeetCode",
110115
"category": "LeetCode"
111116
},
112117
{
113-
"command": "leetcode.submitSolution",
118+
"command": "lcpr.submitSolution",
114119
"title": "Submit to LeetCode",
115120
"category": "LeetCode"
116121
},
117122
{
118-
"command": "leetcode.addFavorite",
123+
"command": "lcpr.addFavorite",
119124
"title": "Add to Favorite List",
120125
"category": "LeetCode",
121126
"icon": {
@@ -124,7 +129,7 @@
124129
}
125130
},
126131
{
127-
"command": "leetcode.removeFavorite",
132+
"command": "lcpr.removeFavorite",
128133
"title": "Remove from Favorite List",
129134
"category": "LeetCode",
130135
"icon": {
@@ -133,12 +138,12 @@
133138
}
134139
},
135140
{
136-
"command": "leetcode.switchDefaultLanguage",
141+
"command": "lcpr.setDefaultLanguage",
137142
"title": "Switch Default Language",
138143
"category": "LeetCode"
139144
},
140145
{
141-
"command": "leetcode.problems.sort",
146+
"command": "lcpr.problems.sort",
142147
"title": "Sort Problems",
143148
"category": "LeetCode",
144149
"icon": "$(sort-precedence)"
@@ -160,106 +165,121 @@
160165
"name": "Problems"
161166
},
162167
{
163-
"id": "LifeExplorer",
164-
"name": "搬砖"
168+
"id": "BricksExplorer",
169+
"name": "搬砖工地"
165170
}
166171
]
167172
},
168173
"menus": {
169174
"view/title": [
170175
{
171-
"command": "leetcode.toggleLeetCodeCn",
176+
"command": "lcpr.toggleLeetCodeCn",
172177
"when": "view == QuestionExplorer",
173178
"group": "navigation@0"
174179
},
175180
{
176-
"command": "leetcode.signin",
181+
"command": "lcpr.signin",
177182
"when": "view == QuestionExplorer",
178183
"group": "navigation@1"
179184
},
180185
{
181-
"command": "leetcode.searchProblem",
186+
"command": "lcpr.searchProblem",
182187
"when": "view == QuestionExplorer",
183188
"group": "navigation@2"
184189
},
185190
{
186-
"command": "leetcode.refreshExplorer",
191+
"command": "lcpr.refreshExplorer",
187192
"when": "view == QuestionExplorer",
188193
"group": "navigation@3"
189194
},
190195
{
191-
"command": "leetcode.pickOne",
196+
"command": "lcpr.pickOne",
192197
"when": "view == QuestionExplorer",
193198
"group": "overflow@0"
194199
},
195200
{
196-
"command": "leetcode.problems.sort",
201+
"command": "lcpr.problems.sort",
197202
"when": "view == QuestionExplorer",
198203
"group": "overflow@1"
199204
},
200205
{
201-
"command": "leetcode.deleteAllCache",
206+
"command": "lcpr.deleteAllCache",
202207
"when": "view == QuestionExplorer",
203208
"group": "overflow@2"
204209
}
205210
],
206211
"view/item/context": [
207212
{
208-
"command": "leetcode.previewProblem",
213+
"command": "lcpr.previewProblem",
209214
"when": "view == QuestionExplorer && viewItem =~ /problem*/",
210215
"group": "leetcode@1"
211216
},
212217
{
213-
"command": "leetcode.showProblem",
218+
"command": "lcpr.showProblem",
214219
"when": "view == QuestionExplorer && viewItem =~ /problem*/",
215220
"group": "leetcode@2"
216221
},
217222
{
218-
"command": "leetcode.showSolution",
223+
"command": "lcpr.showSolution",
219224
"when": "view == QuestionExplorer && viewItem =~ /problem*/",
220225
"group": "leetcode@3"
221226
},
222227
{
223-
"command": "leetcode.addFavorite",
228+
"command": "lcpr.addFavorite",
224229
"when": "view == QuestionExplorer && viewItem == problem",
225230
"group": "inline"
226231
},
227232
{
228-
"command": "leetcode.removeFavorite",
233+
"command": "lcpr.removeFavorite",
229234
"when": "view == QuestionExplorer && viewItem == problem-favorite",
230235
"group": "inline"
236+
},
237+
{
238+
"command": "lcpr.previewProblem",
239+
"when": "view == BricksExplorer && viewItem == bricks",
240+
"group": "leetcode@1"
241+
},
242+
{
243+
"command": "lcpr.showProblem",
244+
"when": "view == BricksExplorer && viewItem == bricks",
245+
"group": "leetcode@2"
246+
},
247+
{
248+
"command": "lcpr.showSolution",
249+
"when": "view == BricksExplorer && viewItem == bricks",
250+
"group": "leetcode@3"
231251
}
232252
],
233253
"commandPalette": [
234254
{
235-
"command": "leetcode.showProblem",
255+
"command": "lcpr.showProblem",
236256
"when": "never"
237257
},
238258
{
239-
"command": "leetcode.showSolution",
259+
"command": "lcpr.showSolution",
240260
"when": "never"
241261
},
242262
{
243-
"command": "leetcode.previewProblem",
263+
"command": "lcpr.previewProblem",
244264
"when": "never"
245265
},
246266
{
247-
"command": "leetcode.addFavorite",
267+
"command": "lcpr.addFavorite",
248268
"when": "never"
249269
},
250270
{
251-
"command": "leetcode.removeFavorite",
271+
"command": "lcpr.removeFavorite",
252272
"when": "never"
253273
}
254274
],
255275
"explorer/context": [
256276
{
257-
"command": "leetcode.testSolution",
277+
"command": "lcpr.testSolution",
258278
"when": "explorerResourceIsFolder == false",
259279
"group": "leetcode@1"
260280
},
261281
{
262-
"command": "leetcode.submitSolution",
282+
"command": "lcpr.submitSolution",
263283
"when": "explorerResourceIsFolder == false",
264284
"group": "leetcode@2"
265285
}
@@ -271,19 +291,19 @@
271291
],
272292
"leetcode.editorAction": [
273293
{
274-
"command": "leetcode.testSolution",
294+
"command": "lcpr.testSolution",
275295
"group": "leetcode@1"
276296
},
277297
{
278-
"command": "leetcode.submitSolution",
298+
"command": "lcpr.submitSolution",
279299
"group": "leetcode@2"
280300
},
281301
{
282-
"command": "leetcode.showSolution",
302+
"command": "lcpr.showSolution",
283303
"group": "leetcode@3"
284304
},
285305
{
286-
"command": "leetcode.previewProblem",
306+
"command": "lcpr.previewProblem",
287307
"group": "leetcode@4"
288308
}
289309
]
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
/*
2+
* Filename: /home/cc/vscode-leetcode-problem-rating/src/controller/BricksViewController.ts
3+
* Path: /home/cc/vscode-leetcode-problem-rating
4+
* Created Date: Tuesday, November 22nd 2022, 11:04:59 am
5+
* Author: ccagml
6+
*
7+
* Copyright (c) 2022 ccagml . All rights reserved.
8+
*/
9+
10+
import { Disposable, TreeItemCollapsibleState } from "vscode";
11+
12+
import { bricksDao } from "../dao/bricksDao";
13+
import { BricksNormalId, defaultProblem } from "../model/Model";
14+
import { BricksNode } from "../model/NodeModel";
15+
import { bricksDataService } from "../service/BricksDataService";
16+
import { treeViewController } from "./TreeViewController";
17+
18+
// 视图控制器
19+
class BricksViewController implements Disposable {
20+
public async initialize() {
21+
await bricksDataService.initialize();
22+
}
23+
24+
// 需要的
25+
public async getHaveNodes() {
26+
let all_qid: string[] = await bricksDao.getTodayBricks();
27+
const baseNode: BricksNode[] = [];
28+
all_qid.forEach((qid) => {
29+
let node = treeViewController.getNodeByQid(qid);
30+
if (node) {
31+
baseNode.push(node);
32+
}
33+
});
34+
return baseNode;
35+
}
36+
// 今天搬的
37+
public async getTodayNodes() {
38+
const baseNode: BricksNode[] = [];
39+
return baseNode;
40+
}
41+
42+
public async getRootNodes(): Promise<BricksNode[]> {
43+
let all_qid: string[] = await bricksDao.getTodayBricks();
44+
let has_qid = all_qid.length > 0;
45+
const baseNode: BricksNode[] = [];
46+
47+
baseNode.push(
48+
new BricksNode(
49+
Object.assign({}, defaultProblem, {
50+
id: has_qid ? BricksNormalId.Have : BricksNormalId.No,
51+
name: has_qid ? BricksNormalId.HaveDesc : BricksNormalId.NoDesc,
52+
}),
53+
false,
54+
0,
55+
has_qid ? TreeItemCollapsibleState.Collapsed : TreeItemCollapsibleState.None
56+
)
57+
);
58+
59+
// baseNode.push(
60+
// new BricksNode(
61+
// Object.assign({}, defaultProblem, {
62+
// id: BricksNormalId.Today,
63+
// name: BricksNormalId.TodayDesc,
64+
// }),
65+
// false,
66+
// 0,
67+
// TreeItemCollapsibleState.Collapsed
68+
// )
69+
// );
70+
71+
return baseNode;
72+
}
73+
public dispose(): void {}
74+
}
75+
76+
export const bricksViewController: BricksViewController = new BricksViewController();

0 commit comments

Comments
 (0)