File tree Expand file tree Collapse file tree 4 files changed +19
-6
lines changed Expand file tree Collapse file tree 4 files changed +19
-6
lines changed Original file line number Diff line number Diff line change 44import * as _ from "lodash" ;
55import { Disposable } from "vscode" ;
66import * as list from "../commands/list" ;
7- import { Category , defaultProblem } from "../shared" ;
7+ import { Category , defaultProblem , ProblemState } from "../shared" ;
8+ import { shouldHideSolvedProblem } from "../utils/settingUtils" ;
89import { LeetCodeNode } from "./LeetCodeNode" ;
910
1011class ExplorerNodeManager implements Disposable {
@@ -14,7 +15,11 @@ class ExplorerNodeManager implements Disposable {
1415
1516 public async refreshCache ( ) : Promise < void > {
1617 this . dispose ( ) ;
18+ const shouldHideSolved : boolean = shouldHideSolvedProblem ( ) ;
1719 for ( const problem of await list . listProblems ( ) ) {
20+ if ( shouldHideSolved && problem . state === ProblemState . AC ) {
21+ continue ;
22+ }
1823 this . explorerNodeMap . set ( problem . id , new LeetCodeNode ( problem ) ) ;
1924 for ( const company of problem . companies ) {
2025 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 44import * as vscode from "vscode" ;
55import { getLeetCodeEndpoint } from "../commands/plugin" ;
66import { leetCodeChannel } from "../leetCodeChannel" ;
7- import { getWorkspaceConfiguration } from "./workspaceUtils " ;
7+ import { getWorkspaceConfiguration } from "./settingUtils " ;
88
99export namespace DialogOptions {
1010 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
4040 }
4141 return wsl . useWsl ( ) ? wsl . toWslPath ( textEditor . document . uri . fsPath ) : textEditor . document . uri . fsPath ;
4242}
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