Skip to content

Commit f2b1a75

Browse files
authored
change the place of the lock decorator (LeetCode-OpenSource#23)
1 parent a44d3db commit f2b1a75

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/commands/show.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -79,26 +79,22 @@ async function showProblemInternal(channel: vscode.OutputChannel, id: string): P
7979
async function parseProblemsToPicks(p: Promise<list.IProblem[]>): Promise<Array<IQuickItemEx<string>>> {
8080
return new Promise(async (resolve: (res: Array<IQuickItemEx<string>>) => void): Promise<void> => {
8181
const picks: Array<IQuickItemEx<string>> = (await p).map((problem: list.IProblem) => Object.assign({}, {
82-
label: `${parseProblemDecorator(problem.state)}${problem.id}.${problem.name}`,
82+
label: `${parseProblemDecorator(problem.state, problem.locked)}${problem.id}.${problem.name}`,
8383
description: "",
84-
detail: `${parseLockDecorator(problem.locked)}AC rate: ${problem.passRate}, Difficulty: ${problem.difficulty}`,
84+
detail: `AC rate: ${problem.passRate}, Difficulty: ${problem.difficulty}`,
8585
value: problem.id,
8686
}));
8787
resolve(picks);
8888
});
8989
}
9090

91-
function parseProblemDecorator(state: ProblemState): string {
91+
function parseProblemDecorator(state: ProblemState, locked: boolean): string {
9292
switch (state) {
9393
case ProblemState.AC:
9494
return "$(check) ";
9595
case ProblemState.NotAC:
9696
return "$(x) ";
9797
default:
98-
return "";
98+
return locked ? "$(lock) " : "";
9999
}
100100
}
101-
102-
function parseLockDecorator(locked: boolean): string {
103-
return locked ? "$(lock) " : "";
104-
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy