Skip to content

Support locked problems #19

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 10, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fixed a typo, added a type def
  • Loading branch information
TsFreddie committed Mar 9, 2018
commit bc019c9bad0c1c9ef5a6edc753cfdd340e29fbf2
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
"properties": {
"leetcode.showLocked": {
"type": "boolean",
"default": true,
"default": false,
"description": "Show locked problems."
},
"leetcode.defaultLanguage": {
Expand Down
6 changes: 3 additions & 3 deletions src/commands/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { executeCommand } from "../utils/cpUtils";
import { DialogType, promptForOpenOutputChannel } from "../utils/uiUtils";

export interface IProblem {
favorate: boolean;
favorite: boolean;
locked: boolean;
state: ProblemState;
id: string;
Expand All @@ -22,7 +22,7 @@ export async function listProblems(channel: vscode.OutputChannel): Promise<IProb
return [];
}
const leetCodeConfig: vscode.WorkspaceConfiguration = vscode.workspace.getConfiguration("leetcode");
const showLocked = leetCodeConfig.get<string>("showLocked");
const showLocked: boolean | undefined = leetCodeConfig.get<boolean>("showLocked");
const result: string = await executeCommand(channel, "node", showLocked ? [leetCodeBinaryPath, "list"] : [leetCodeBinaryPath, "list", "-q", "L"]);
const problems: IProblem[] = [];
const lines: string[] = result.split("\n");
Expand All @@ -31,7 +31,7 @@ export async function listProblems(channel: vscode.OutputChannel): Promise<IProb
const match: RegExpMatchArray | null = line.match(reg);
if (match && match.length === 8) {
problems.push({
favorate: match[1].trim().length > 0,
favorite: match[1].trim().length > 0,
locked: match[2].trim().length > 0,
state: parseProblemState(match[3]),
id: match[4].trim(),
Expand Down
4 changes: 2 additions & 2 deletions src/leetCodeExplorer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export class LeetCodeTreeDataProvider implements vscode.TreeDataProvider<LeetCod
return [
new LeetCodeNode(
{
favorate: false,
favorite: false,
locked: false,
state: ProblemState.Unknown,
id: "notSignIn",
Expand Down Expand Up @@ -130,7 +130,7 @@ export class LeetCodeTreeDataProvider implements vscode.TreeDataProvider<LeetCod
difficultynodes.push(
new LeetCodeNode(
{
favorate: false,
favorite: false,
locked: false,
state: ProblemState.Unknown,
id: difficulty,
Expand Down