diff --git a/CHANGELOG.md b/CHANGELOG.md index d359e5d..da596f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## version 2.19.12 + +- 配置 filePath 文件名 ${name} ${camelcasename} ${pascalcasename} ${kebabcasename} ${kebab-case-name} ${snakecasename} ${snake_case_name} 原本参数使用英文名 +- 配置 filePath 文件名 增加 ${cn_name} ${cnname} 如果有中文名称的话,使用中文名称 + ## version 2.19.11 - 生成区域调试参数后尝试直接发起调试 diff --git a/README.md b/README.md index 55e97e9..78d2f01 100644 --- a/README.md +++ b/README.md @@ -199,27 +199,27 @@ ## 插件配置项 -| 配置项名称显示红色为与官方配置有不同的地方 | 描述 | 默认值 | -| --------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------- | -| leetcode-problem-rating.hideSolved | 指定是否要隐藏已解决的问题 | `false` | -| leetcode-problem-rating.showLocked` | 指定是否显示付费题目,只有付费账户才可以打开付费题目 | `false` | -| leetcode-problem-rating.defaultLanguage | 指定答题时使用的默认语言,可选语言有:`bash`, `c`, `cpp`, `csharp`, `golang`, `java`, `javascript`, `kotlin`, `mysql`, `php`, `python`,`python3`,`ruby`, `rust`, `scala`, `swift`, `typescript` | `N/A` | -| leetcode-problem-rating.useWsl | 指定是否启用 WSL | `false` | -| leetcode-problem-rating.endpoint | 指定使用的终端,可用终端有:`leetcode`, `leetcode-cn` | leetcode.cn | -| leetcode-problem-rating.workspaceFolder | 指定保存文件的工作区目例如/home/${USERNAME}/leetcode, 现在会尝试从系统环境变量读取 USERNAME 对应的值, 例如环境变量中 USERNAME 是 ccagml,那么就会是/home/ccagml/leetcode 录 | `""` | -| leetcode-problem-rating.filePath | 指定生成题目文件的相对文件夹路径名和文件名。点击查看[更多详细用法](https://github.com/LeetCode-OpenSource/vscode-leetcode/wiki/%E8%87%AA%E5%AE%9A%E4%B9%89%E9%A2%98%E7%9B%AE%E6%96%87%E4%BB%B6%E7%9A%84%E7%9B%B8%E5%AF%B9%E6%96%87%E4%BB%B6%E5%A4%B9%E8%B7%AF%E5%BE%84%E5%92%8C%E6%96%87%E4%BB%B6%E5%90%8D)。 额外拓展\${yyyymmdd}、${timestamp}格式 | | -| leetcode-problem-rating.enableStatusBar | 指定是否在 VS Code 下方显示插件状态栏。 增加周赛分数据 | `true` | -| leetcode-problem-rating.editor.shortcuts | 指定在编辑器内所自定义的快捷方式。可用的快捷方式有: `submit`, `test`, `star`, `solution`, `description`, case, allcase 。 | ["submit, case, allcase, test, solution"] | -| leetcode-problem-rating.enableSideMode | 指定在解决一道题时,是否将`问题预览`、`高票答案`与`提交结果`窗口集中在编辑器的第二栏。 | `true` | -| leetcode-problem-rating.nodePath | 指定 `Node.js` 可执行文件的路径。如:C:\Program Files\nodejs\node.exe | `node` | -| leetcode-problem-rating.showCommentDescription | 指定是否要在注释中显示题干。 | `false` | -| leetcode-problem-rating.useEndpointTranslation | 是否显示翻译版本内容。 | `true` | -| leetcode-problem-rating.sortStrategy | 排序的选项。Acceptance Rate (Ascending):通过率递增 Acceptance Rate (Descending):通过率递减 Score (Ascending):分数递增 Score (Descending):分数递减 | None | -| leetcode-problem-rating.pickOneByRankRangeMin | 随机一题的最小浮动,随机一题最低分(你的竞赛分+本配置)。 | 50 | -| leetcode-problem-rating.pickOneByRankRangeMax | 随机一题的最大浮动,随机一题最高分(你的竞赛分+本配置)。 | 150 | -| leetcode-problem-rating.hideScore | 隐藏分数相关的题目。Score:隐藏有分数的题目, NoScore:隐藏没有分数的题目, ScoreRange:隐藏分数范围外的题目 | None | -| leetcode-problem-rating.useVscodeNode | 默认情况下使用 VsCode 自带 Node 环境,不需要额外安装 Node 环境 | true | -| leetcode-problem-rating.answerDiffColor | 答案不同的地方上色 | false | +| 配置项名称显示红色为与官方配置有不同的地方 | 描述 | 默认值 | +| --------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------- | +| leetcode-problem-rating.hideSolved | 指定是否要隐藏已解决的问题 | `false` | +| leetcode-problem-rating.showLocked` | 指定是否显示付费题目,只有付费账户才可以打开付费题目 | `false` | +| leetcode-problem-rating.defaultLanguage | 指定答题时使用的默认语言,可选语言有:`bash`, `c`, `cpp`, `csharp`, `golang`, `java`, `javascript`, `kotlin`, `mysql`, `php`, `python`,`python3`,`ruby`, `rust`, `scala`, `swift`, `typescript` | `N/A` | +| leetcode-problem-rating.useWsl | 指定是否启用 WSL | `false` | +| leetcode-problem-rating.endpoint | 指定使用的终端,可用终端有:`leetcode`, `leetcode-cn` | leetcode.cn | +| leetcode-problem-rating.workspaceFolder | 指定保存文件的工作区目例如/home/${USERNAME}/leetcode, 现在会尝试从系统环境变量读取 USERNAME 对应的值, 例如环境变量中 USERNAME 是 ccagml,那么就会是/home/ccagml/leetcode 录 | `""` | +| leetcode-problem-rating.filePath | 指定生成题目文件的相对文件夹路径名和文件名。点击查看[更多详细用法](https://github.com/LeetCode-OpenSource/vscode-leetcode/wiki/%E8%87%AA%E5%AE%9A%E4%B9%89%E9%A2%98%E7%9B%AE%E6%96%87%E4%BB%B6%E7%9A%84%E7%9B%B8%E5%AF%B9%E6%96%87%E4%BB%B6%E5%A4%B9%E8%B7%AF%E5%BE%84%E5%92%8C%E6%96%87%E4%BB%B6%E5%90%8D)。 额外拓展\${yyyymmdd}对应年月日 20230720、\${timestamp}对应时间戳格式、\${cn_name}题目的中文名称 | | +| leetcode-problem-rating.enableStatusBar | 指定是否在 VS Code 下方显示插件状态栏。 增加周赛分数据 | `true` | +| leetcode-problem-rating.editor.shortcuts | 指定在编辑器内所自定义的快捷方式。可用的快捷方式有: `submit`, `test`, `star`, `solution`, `description`, case, allcase 。 | ["submit, case, allcase, test, solution"] | +| leetcode-problem-rating.enableSideMode | 指定在解决一道题时,是否将`问题预览`、`高票答案`与`提交结果`窗口集中在编辑器的第二栏。 | `true` | +| leetcode-problem-rating.nodePath | 指定 `Node.js` 可执行文件的路径。如:C:\Program Files\nodejs\node.exe | `node` | +| leetcode-problem-rating.showCommentDescription | 指定是否要在注释中显示题干。 | `false` | +| leetcode-problem-rating.useEndpointTranslation | 是否显示翻译版本内容。 | `true` | +| leetcode-problem-rating.sortStrategy | 排序的选项。Acceptance Rate (Ascending):通过率递增 Acceptance Rate (Descending):通过率递减 Score (Ascending):分数递增 Score (Descending):分数递减 | None | +| leetcode-problem-rating.pickOneByRankRangeMin | 随机一题的最小浮动,随机一题最低分(你的竞赛分+本配置)。 | 50 | +| leetcode-problem-rating.pickOneByRankRangeMax | 随机一题的最大浮动,随机一题最高分(你的竞赛分+本配置)。 | 150 | +| leetcode-problem-rating.hideScore | 隐藏分数相关的题目。Score:隐藏有分数的题目, NoScore:隐藏没有分数的题目, ScoreRange:隐藏分数范围外的题目 | None | +| leetcode-problem-rating.useVscodeNode | 默认情况下使用 VsCode 自带 Node 环境,不需要额外安装 Node 环境 | true | +| leetcode-problem-rating.answerDiffColor | 答案不同的地方上色 | false | ## 更新日志 diff --git a/package.json b/package.json index 23a9f2d..2d0dfb4 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "vscode-leetcode-problem-rating", "displayName": "LeetCode", "description": "%main.description%", - "version": "2.19.11", + "version": "2.19.12", "author": "ccagml", "publisher": "ccagml", "license": "MIT", diff --git a/src/controller/TreeViewController.ts b/src/controller/TreeViewController.ts index 1f9bc99..3c4a4d3 100644 --- a/src/controller/TreeViewController.ts +++ b/src/controller/TreeViewController.ts @@ -469,6 +469,8 @@ class TreeViewController implements Disposable { locked: p.locked, state: this.parseProblemState(p.state), name: p.name, + cn_name: p.cn_name, + en_name: p.en_name, difficulty: p.level, passRate: p.percent, companies: p.companies || [], @@ -986,18 +988,21 @@ class TreeViewController implements Disposable { switch (placeholder) { case "id": return node.id; + case "cnname": + case "cn_name": + return node.cn_name || node.name; case "name": - return node.name; + return node.en_name || node.name; case "camelcasename": - return lodash.camelCase(node.name); + return lodash.camelCase(node.en_name || node.name); case "pascalcasename": - return lodash.upperFirst(lodash.camelCase(node.name)); + return lodash.upperFirst(lodash.camelCase(node.en_name || node.name)); case "kebabcasename": case "kebab-case-name": - return lodash.kebabCase(node.name); + return lodash.kebabCase(node.en_name || node.name); case "snakecasename": case "snake_case_name": - return lodash.snakeCase(node.name); + return lodash.snakeCase(node.en_name || node.name); case "ext": return genFileExt(selectedLanguage); case "language": diff --git a/src/model/Model.ts b/src/model/Model.ts index 6adc1da..ff34052 100644 --- a/src/model/Model.ts +++ b/src/model/Model.ts @@ -107,6 +107,8 @@ export interface IProblem { id: string; // 题目编号 fid qid: string; name: string; + cn_name: string; + en_name: string; difficulty: string; passRate: string; companies: string[]; @@ -139,6 +141,8 @@ export const defaultProblem: IProblem = { id: "", qid: "", name: "", + cn_name: "", + en_name: "", difficulty: "", passRate: "", companies: [] as string[], diff --git a/src/model/NodeModel.ts b/src/model/NodeModel.ts index 0cab6ab..5c84c91 100644 --- a/src/model/NodeModel.ts +++ b/src/model/NodeModel.ts @@ -22,6 +22,12 @@ export class NodeModel { public get name(): string { return this.data.name; } + public get cn_name(): string { + return this.data.cn_name; + } + public get en_name(): string { + return this.data.en_name; + } public get state(): ProblemState { // 每日一题的修正 diff --git a/src/rpc/actionChain/chainNode/leetcode.cn.ts b/src/rpc/actionChain/chainNode/leetcode.cn.ts index d95b7e0..d2ed1d0 100644 --- a/src/rpc/actionChain/chainNode/leetcode.cn.ts +++ b/src/rpc/actionChain/chainNode/leetcode.cn.ts @@ -38,7 +38,11 @@ class LeetCodeCn extends ChainNodeBase { problems.forEach(function (problem) { const title = titles[problem.id]; - if (title) problem.name = title; + if (title) { + problem.en_name = problem.name; + problem.name = title; + problem.cn_name = title; + } }); return cb(null, problems);