-
Notifications
You must be signed in to change notification settings - Fork 665
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
Conversation
Hi @TsFreddie Thank you for the contribution! Looks nice! Just interested about the intension of supporting locked problem. Could you please explain more about this feature to me? |
@TsFreddie Oh, got your idea. That means: although the icon is a lock, but the paid user still can open the problem and try to solve it. Am I right? I don't have a premium account so I was not aware of that. π |
Exactly. leetcode-cli isn't very descriptive about what it means by "locked". |
Good to know that. Thanks for pointing out. π I still have some stuff need to do. Will review the PR in detail ASAP! |
src/commands/list.ts
Outdated
@@ -7,6 +7,8 @@ import { executeCommand } from "../utils/cpUtils"; | |||
import { DialogType, promptForOpenOutputChannel } from "../utils/uiUtils"; | |||
|
|||
export interface IProblem { | |||
favorate: boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: favorite
src/commands/list.ts
Outdated
@@ -19,19 +21,23 @@ export async function listProblems(channel: vscode.OutputChannel): Promise<IProb | |||
if (leetCodeManager.getStatus() === UserStatus.SignedOut) { | |||
return []; | |||
} | |||
const result: string = await executeCommand(channel, "node", [leetCodeBinaryPath, "list", "-q", "L"]); | |||
const leetCodeConfig: vscode.WorkspaceConfiguration = vscode.workspace.getConfiguration("leetcode"); | |||
const showLocked = leetCodeConfig.get<string>("showLocked"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: add a type definition: const showLocked: boolean
= ...
package.json
Outdated
@@ -129,6 +129,11 @@ | |||
{ | |||
"title": "LeetCode", | |||
"properties": { | |||
"leetcode.showLocked": { | |||
"type": "boolean", | |||
"default": true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest we set the default value to false, since I think there are more common users than the premium ones.
@TsFreddie Just some small changes, thanks. |
Great! Thanks. |
Issue: #20
Added support for locked problems.
The regex is changed to match favorite, locked and state:
The lock icon is grabbed from EmojiOne v2.0, please change it or add a license.
Please review the regex before merge.