8000 feat: Add 'All' category into the explorer (#309) · iFun/vscode-leetcode@a521cf5 · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a521cf5

Browse files
authored
feat: Add 'All' category into the explorer (LeetCode-OpenSource#309)
1 parent 65f41c0 commit a521cf5

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

src/explorer/LeetCodeTreeDataProvider.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ export class LeetCodeTreeDataProvider implements vscode.TreeDataProvider<LeetCod
6060
return explorerNodeManager.getRootNodes();
6161
} else {
6262
switch (element.id) { // First-level
63+
case Category.All:
64+
return explorerNodeManager.getAllNodes();
6365
case Category.Favorite:
6466
return explorerNodeManager.getFavoriteNodes();
6567
case Category.Difficulty:

src/explorer/explorerNodeManager.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ class ExplorerNodeManager implements Disposable {
2727

2828
public getRootNodes(): LeetCodeNode[] {
2929
return [
30+
new LeetCodeNode(Object.assign({}, defaultProblem, {
31+
id: Category.All,
32+
name: Category.All,
33+
}), false),
3034
new LeetCodeNode(Object.assign({}, defaultProblem, {
3135
id: Category.Difficulty,
3236
name: Category.Difficulty,
@@ -46,6 +50,10 @@ class ExplorerNodeManager implements Disposable {
4650
];
4751
}
4852

53+
public getAllNodes(): LeetCodeNode[] {
54+
return Array.from(this.explorerNodeMap.values());
55+
}
56+
4957
public getAllDifficultyNodes(): LeetCodeNode[] {
5058
const res: LeetCodeNode[] = [];
5159
res.push(

src/shared.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ export const defaultProblem: IProblem = {
8686
};
8787

8888
export enum Category {
89+
All = "All",
8990
Difficulty = "Difficulty",
9091
Tag = "Tag",
9192
Company = "Company",

0 commit comments

Comments
 (0)
0