Skip to content

使用${tag}作为文件夹名称不生效 #160

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

Merged
merged 3 commits into from
Jan 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## version 2.12.2

- 修复 使用${tag}作为文件夹名称不生效
- 更新 README.md

## version 2.12.1

- 配置filePath文件名 增加 ${yyyymmdd}格式
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@

## 更新日志

请参考[更新日志](https://github.com/ccagml/leetcode-vscode/CHANGELOG.md)
请参考[更新日志](CHANGELOG.md)

## 鸣谢

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "vscode-leetcode-problem-rating",
"displayName": "LeetCode",
"description": "LeetCode 官方插件增强, 代码开源, 增加 LeetCode 题目难度分, 给个star吧, 球球了",
"version": "2.12.1",
"version": "2.12.2",
"author": "ccagml",
"publisher": "ccagml",
"license": "MIT",
Expand Down
9 changes: 5 additions & 4 deletions src/controller/TreeViewController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -946,7 +946,7 @@ class TreeViewController implements Disposable {

public async resolveRelativePath(relativePath: string, node: IProblem, selectedLanguage: string): Promise<string> {
let tag: string = "";
if (/\$\{ tag \} /i.test(relativePath)) {
if (/\$\{tag\}/i.test(relativePath)) {
tag = (await this.resolveTagForProblem(node)) || "";
}

Expand Down Expand Up @@ -996,10 +996,11 @@ class TreeViewController implements Disposable {
}

public async resolveTagForProblem(problem: IProblem): Promise<string | undefined> {
if (problem.tags.length === 1) {
return problem.tags[0];
let path_en_tags = treeDataService.getTagsDataEn(problem.id)
if (path_en_tags.length === 1) {
return path_en_tags[0];
}
return await vscode.window.showQuickPick(problem.tags, {
return await vscode.window.showQuickPick(path_en_tags, {
matchOnDetail: true,
placeHolder: "Multiple tags available, please select one",
ignoreFocusOut: true,
Expand Down
62 changes: 33 additions & 29 deletions src/dao/tagsDao.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4600,74 +4600,74 @@ class TagsDao {
};

private tags_name = {
array: "数组",
"array": "数组",
"hash-table": "哈希表",
recursion: "递归",
"recursion": "递归",
"linked-list": "链表",
math: "数学",
string: "字符串",
"math": "数学",
"string": "字符串",
"sliding-window": "滑动窗口",
"binary-search": "二分搜索",
"divide-and-conquer": "分治",
"dynamic-programming": "动态规划",
greedy: "贪心",
"greedy": "贪心",
"two-pointers": "双指针",
sorting: "排序",
backtracking: "回溯",
stack: "堆",
"sorting": "排序",
"backtracking": "回溯",
"stack": "堆",
"heap-priority-queue": "优先级队列",
"merge-sort": "归并排序",
"string-matching": "字符串匹配",
"bit-manipulation": "位操作",
matrix: "矩阵",
"matrix": "矩阵",
"monotonic-stack": "单调栈",
simulation: "模拟",
combinatorics: "组合学",
memoization: "记忆",
tree: "树",
"simulation": "模拟",
"combinatorics": "组合学",
"memoization": "记忆",
"tree": "树",
"depth-first-search": "深度优先搜索",
"binary-tree": "二叉树",
"binary-search-tree": "二叉搜索树",
"breadth-first-search": "广度优先搜索",
"union-find": "并查集",
graph: "图",
trie: "尝试",
design: "设计",
"graph": "图",
"trie": "尝试",
"design": "设计",
"doubly-linked-list": "双向链表",
geometry: "几何学",
interactive: "交互的",
"geometry": "几何学",
"interactive": "交互的",
"bucket-sort": "桶排序",
"radix-sort": "基数排序",
counting: "数数",
"counting": "数数",
"data-stream": "数据流",
iterator: "迭代器",
database: "数据库",
"iterator": "迭代器",
"database": "数据库",
"hash-function": "散列函数",
"rolling-hash": "滚动哈希",
shell: "脚本",
enumeration: "枚举",
"shell": "脚本",
"enumeration": "枚举",
"number-theory": "数论",
"topological-sort": "拓扑排序",
"prefix-sum": "前缀和",
quickselect: "快速选择",
"quickselect": "快速选择",
"binary-indexed-tree": "二进制索引树",
"segment-tree": "线段树",
"ordered-set": "有序集",
"line-sweep": "扫描线",
queue: "队列",
"queue": "队列",
"monotonic-queue": "单调队列",
"counting-sort": "计数排序",
brainteaser: "脑筋急转弯",
"brainteaser": "脑筋急转弯",
"game-theory": "博弈论",
"eulerian-circuit": "欧拉回路",
randomized: "随机",
"randomized": "随机",
"reservoir-sampling": "水库采样",
"shortest-path": "最短路径",
bitmask: "位掩码",
"bitmask": "位掩码",
"rejection-sampling": "拒绝抽样",
"probability-and-statistics": "概率和统计",
"suffix-array": "后缀数组",
concurrency: "并发",
"concurrency": "并发",
"minimum-spanning-tree": "最小生成树",
"biconnected-component": "双连接组件",
"strongly-connected-component": "强连接组件",
Expand All @@ -4677,6 +4677,10 @@ class TagsDao {
return this.tags_name[p];
});
}

public getTagsDataEn(fid: string): Array<string> {
return this.tagsData[fid]?.topicTags
}
}

export const tagsDao: TagsDao = new TagsDao();
6 changes: 5 additions & 1 deletion src/service/TreeDataService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export class TreeDataService implements vscode.TreeDataProvider<NodeModel> {
return [];
} else {
switch (
element.id // First-level
element.id // First-level
) {
case Category.All:
return treeViewController.getAllNodes();
Expand Down Expand Up @@ -155,6 +155,10 @@ export class TreeDataService implements vscode.TreeDataProvider<NodeModel> {
return tagsDao.getTagsData(fid) || ["Unknown"];
}

public getTagsDataEn(fid: string): Array<string> {
return tagsDao.getTagsDataEn(fid) || ["Unknown"];
}

// 返回题目id的数据
public getScoreData(): Map<string, IScoreData> {
return scoreDao.getScoreData();
Expand Down