File tree 4 files changed +19
-6
lines changed
4 files changed +19
-6
lines changed Original file line number Diff line number Diff line change 4
4
import * as _ from "lodash" ;
5
5
import { Disposable } from "vscode" ;
6
6
import * as list from "../commands/list" ;
7
- import { Category , defaultProblem } from "../shared" ;
7
+ import { Category , defaultProblem , ProblemState } from "../shared" ;
8
+ import { shouldHideSolvedProblem } from "../utils/settingUtils" ;
8
9
import { LeetCodeNode } from "./LeetCodeNode" ;
9
10
10
11
class ExplorerNodeManager implements Disposable {
@@ -14,7 +15,11 @@ class ExplorerNodeManager implements Disposable {
14
15
15
16
public async refreshCache ( ) : Promise < void > {
16
17
this . dispose ( ) ;
18
+ const shouldHideSolved : boolean = shouldHideSolvedProblem ( ) ;
17
19
for ( const problem of await list . listProblems ( ) ) {
20
+ if ( shouldHideSolved && problem . state === ProblemState . AC ) {
21
+ continue ;
22
+ }
18
23
this . explorerNodeMap . set ( problem . id , new LeetCodeNode ( problem ) ) ;
19
24
for ( const company of problem . companies ) {
20
25
this . companySet . add ( company ) ;
Original file line number Diff line number Diff line change
1
+ // Copyright (c) jdneo. All rights reserved.
2
+ // Licensed under the MIT license.
3
+
4
+ import { workspace , WorkspaceConfiguration } from "vscode" ;
5
+
6
+ export function getWorkspaceConfiguration ( ) : WorkspaceConfiguration {
7
+ return workspace . getConfiguration ( "leetcode" ) ;
8
+ }
9
+
10
+ export function shouldHideSolvedProblem ( ) : boolean {
11
+ return getWorkspaceConfiguration ( ) . get < boolean > ( "hideSolved" , false ) ;
12
+ }
Original file line number Diff line number Diff line change 4
4
import * as vscode from "vscode" ;
5
5
import { getLeetCodeEndpoint } from "../commands/plugin" ;
6
6
import { leetCodeChannel } from "../leetCodeChannel" ;
7
- import { getWorkspaceConfiguration } from "./workspaceUtils " ;
7
+ import { getWorkspaceConfiguration } from "./settingUtils " ;
8
8
9
9
export namespace DialogOptions {
10
10
export const open : vscode . MessageItem = { title : "Open" } ;
Original file line number Diff line number Diff line change @@ -40,7 +40,3 @@ export async function getActiveFilePath(uri?: vscode.Uri): Promise<string | unde
40
40
}
41
41
return wsl . useWsl ( ) ? wsl . toWslPath ( textEditor . document . uri . fsPath ) : textEditor . document . uri . fsPath ;
42
42
}
43
-
44
- export function getWorkspaceConfiguration ( ) : vscode . WorkspaceConfiguration {
45
- return vscode . workspace . getConfiguration ( "leetcode" ) ;
46
- }
You can’t perform that action at this time.
0 commit comments