Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 57a0b87

Browse files
committed
get en name from desc.url
1 parent adf255c commit 57a0b87

File tree

5 files changed

+12
-0
lines changed

5 files changed

+12
-0
lines changed

src/commands/list.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export async function listProblems(): Promise<IProblem[]> {
3131
locked: match[2].trim().length > 0,
3232
state: parseProblemState(match[3]),
3333
name: match[5].trim(),
34+
name_en: "",
3435
difficulty: match[6].trim(),
3536
passRate: match[7].trim(),
3637
companies: companies[id] || ["Unknown"],

src/commands/show.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,8 @@ async function resolveRelativePath(relativePath: string, node: IProblem, selecte
234234
return node.id;
235235
case "name":
236236
return node.name;
237+
case "name_en":
238+
return node.name_en;
237239
case "camelcasename":
238240
return _.camelCase(node.name);
239241
case "pascalcasename":

src/explorer/LeetCodeNode.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ export class LeetCodeNode {
1414
public get name(): string {
1515
return this.data.name;
1616
}
17+
public get name_en(): string {
18+
return this.data.name_en;
19+
}
20+
public set name_en(name_en: string) {
21+
this.data.name_en = name_en;
22+
}
1723

1824
public get state(): ProblemState {
1925
return this.data.state;

src/shared.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ export interface IProblem {
7676
state: ProblemState;
7777
id: string;
7878
name: string;
79+
name_en: string;
7980
difficulty: string;
8081
passRate: string;
8182
companies: string[];
@@ -88,6 +89,7 @@ export const defaultProblem: IProblem = {
8889
state: ProblemState.Unknown,
8990
id: "",
9091
name: "",
92+
name_en: "",
9193
difficulty: "",
9294
passRate: "",
9395
companies: [] as string[],

src/webview/leetCodePreviewProvider.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ class LeetCodePreviewProvider extends LeetCodeWebview {
162162
/* testcase */, ,
163163
...body
164164
] = descString.split("\n");
165+
problem.name_en = url.substring(url.indexOf("problems") + 9, url.indexOf("description") - 1).replace("/", "_");
165166
return {
166167
title: problem.name,
167168
url,

0 commit comments

Comments
 (0)