diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ad51fc..597afd8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## version 2.17.8 + +- 替换中文题解中的 textit + ## version 2.17.7 - filepath 格式可以保存在工作区,避免每次新环境还要配文件名 diff --git a/package.json b/package.json index 781a71c..ea81049 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "vscode-leetcode-problem-rating", "displayName": "LeetCode", "description": "%main.description%", - "version": "2.17.7", + "version": "2.17.8", "author": "ccagml", "publisher": "ccagml", "license": "MIT", diff --git a/src/controller/TreeViewController.ts b/src/controller/TreeViewController.ts index d58b56a..ea810df 100644 --- a/src/controller/TreeViewController.ts +++ b/src/controller/TreeViewController.ts @@ -511,11 +511,6 @@ class TreeViewController implements Disposable { } public async searchProblem(): Promise { - if (!statusBarService.getUser()) { - promptForSignIn(); - return; - } - const picks: Array> = []; picks.push( { @@ -538,17 +533,6 @@ class TreeViewController implements Disposable { // detail: `测试api`, // value: `testapi`, // } - // , - // { - // label: `每日一题`, - // detail: `每日一题`, - // value: `today`, - // }, - // { - // label: `查询自己竞赛信息`, - // detail: `查询自己竞赛信息`, - // value: `userContest`, - // } ); const choice: IQuickItemEx | undefined = await vscode.window.showQuickPick(picks, { title: "选择查询选项", @@ -556,6 +540,12 @@ class TreeViewController implements Disposable { if (!choice) { return; } + + if (!statusBarService.getUser() && choice.value != "testapi") { + promptForSignIn(); + return; + } + if (choice.value == "byid") { await this.searchProblemByID(); } else if (choice.value == "range") { @@ -637,14 +627,10 @@ class TreeViewController implements Disposable { } public async testapi(): Promise { - if (!statusBarService.getUser()) { - promptForSignIn(); - return; - } try { - let problemInput = await getTextEditorFilePathByUri(); - // vscode.window.showErrorMessage(twoFactor || "输入错误"); - const solution: string = await executeService.getTestApi(problemInput || ""); + let so = {}; + + const solution: string = JSON.stringify(so); solutionService.show(solution); } catch (error) { logOutput.appendLine(error.toString()); diff --git a/src/rpc/actionChain/chainNode/leetcode.cn.ts b/src/rpc/actionChain/chainNode/leetcode.cn.ts index c76fe07..8ae05e3 100644 --- a/src/rpc/actionChain/chainNode/leetcode.cn.ts +++ b/src/rpc/actionChain/chainNode/leetcode.cn.ts @@ -262,7 +262,15 @@ function getSolutionBySlug(question_slug: string, articles_slug: string, lang: s if (!solution) return reply.error("本题没有题解"); let link = URL_DISCUSS.replace("$slug", question_slug).replace("$articles_slug", articles_slug); - let content = solution.content.replace(/\\n/g, "\n").replace(/\\t/g, "\t"); + // let content = solution.content.replace(/\\n/g, "\n").replace(/\\t/g, "\t"); + let content = solution.content.replace(/\\n/g, "\n"); + + // content = content.replace(/\$\\textit/g, "$"); + // content = content.replace(/\$\\texttt/g, "$"); + // content = content.replace(/\$\\text/g, "$"); + content = content.replace(/\\textit{/g, "{"); + content = content.replace(/\\texttt{/g, "{"); + content = content.replace(/\\text{/g, "{"); let solution_result: any = {}; solution_result.problem_name = solution.title; diff --git a/src/service/SolutionService.ts b/src/service/SolutionService.ts index 0aa2cc4..90f9d87 100644 --- a/src/service/SolutionService.ts +++ b/src/service/SolutionService.ts @@ -56,9 +56,9 @@ class SolutionService extends BaseWebViewService { ); // $\textit - this.solution.body = this.solution.body.replace(/\$\textit/g, "$"); - this.solution.body = this.solution.body.replace(/\$\texttt/g, "$"); - this.solution.body = this.solution.body.replace(/\$\text/g, "$"); + // this.solution.body = this.solution.body.replace(/\$\\textit/g, "$"); + // this.solution.body = this.solution.body.replace(/\$\\texttt/g, "$"); + // this.solution.body = this.solution.body.replace(/\$\\text/g, "$"); const body: string = markdownService.render(this.solution.body, { lang: this.solution.lang,