Skip to content

Commit f77cfb1

Browse files
authored
Merge pull request #199 from ccagml/main
替换中文题解中的 textit
2 parents d6abb5e + 520c6ce commit f77cfb1

File tree

5 files changed

+26
-28
lines changed

5 files changed

+26
-28
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## version 2.17.8
2+
3+
- 替换中文题解中的 textit
4+
15
## version 2.17.7
26

37
- filepath 格式可以保存在工作区,避免每次新环境还要配文件名

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "vscode-leetcode-problem-rating",
33
"displayName": "LeetCode",
44
"description": "%main.description%",
5-
"version": "2.17.7",
5+
"version": "2.17.8",
66
"author": "ccagml",
77
"publisher": "ccagml",
88
"license": "MIT",

src/controller/TreeViewController.ts

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -511,11 +511,6 @@ class TreeViewController implements Disposable {
511511
}
512512

513513
public async searchProblem(): Promise<void> {
514-
if (!statusBarService.getUser()) {
515-
promptForSignIn();
516-
return;
517-
}
518-
519514
const picks: Array<IQuickItemEx<string>> = [];
520515
picks.push(
521516
{
@@ -538,24 +533,19 @@ class TreeViewController implements Disposable {
538533
// detail: `测试api`,
539534
// value: `testapi`,
540535
// }
541-
// ,
542-
// {
543-
// label: `每日一题`,
544-
// detail: `每日一题`,
545-
// value: `today`,
546-
// },
547-
// {
548-
// label: `查询自己竞赛信息`,
549-
// detail: `查询自己竞赛信息`,
550-
// value: `userContest`,
551-
// }
552536
);
553537
const choice: IQuickItemEx<string> | undefined = await vscode.window.showQuickPick(picks, {
554538
title: "选择查询选项",
555539
});
556540
if (!choice) {
557541
return;
558542
}
543+
544+
if (!statusBarService.getUser() && choice.value != "testapi") {
545+
promptForSignIn();
546+
return;
547+
}
548+
559549
if (choice.value == "byid") {
560550
await this.searchProblemByID();
561551
} else if (choice.value == "range") {
@@ -637,14 +627,10 @@ class TreeViewController implements Disposable {
637627
}
638628

639629
public async testapi(): Promise<void> {
640-
if (!statusBarService.getUser()) {
641-
promptForSignIn();
642-
return;
643-
}
644630
try {
645-
let problemInput = await getTextEditorFilePathByUri();
646-
// vscode.window.showErrorMessage(twoFactor || "输入错误");
647-
const solution: string = await executeService.getTestApi(problemInput || "");
631+
let so = {};
632+
633+
const solution: string = JSON.stringify(so);
648634
solutionService.show(solution);
649635
} catch (error) {
650636
logOutput.appendLine(error.toString());

src/rpc/actionChain/chainNode/leetcode.cn.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,15 @@ function getSolutionBySlug(question_slug: string, articles_slug: string, lang: s
262262
if (!solution) return reply.error("本题没有题解");
263263

264264
let link = URL_DISCUSS.replace("$slug", question_slug).replace("$articles_slug", articles_slug);
265-
let content = solution.content.replace(/\\n/g, "\n").replace(/\\t/g, "\t");
265+
// let content = solution.content.replace(/\\n/g, "\n").replace(/\\t/g, "\t");
266+
let content = solution.content.replace(/\\n/g, "\n");
267+
268+
// content = content.replace(/\$\\textit/g, "$");
269+
// content = content.replace(/\$\\texttt/g, "$");
270+
// content = content.replace(/\$\\text/g, "$");
271+
content = content.replace(/\\textit{/g, "{");
272+
content = content.replace(/\\texttt{/g, "{");
273+
content = content.replace(/\\text{/g, "{");
266274

267275
let solution_result: any = {};
268276
solution_result.problem_name = solution.title;

src/service/SolutionService.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ class SolutionService extends BaseWebViewService {
5656
);
5757

5858
// $\textit
59-
this.solution.body = this.solution.body.replace(/\$\textit/g, "$");
60-
this.solution.body = this.solution.body.replace(/\$\texttt/g, "$");
61-
this.solution.body = this.solution.body.replace(/\$\text/g, "$");
59+
// this.solution.body = this.solution.body.replace(/\$\\textit/g, "$");
60+
// this.solution.body = this.solution.body.replace(/\$\\texttt/g, "$");
61+
// this.solution.body = this.solution.body.replace(/\$\\text/g, "$");
6262

6363
const body: string = markdownService.render(this.solution.body, {
6464
lang: this.solution.lang,

0 commit comments

Comments
 (0)