Skip to content

Commit ad9916c

Browse files
committed
Add Click the tree explorer should open the topic (LeetCode-OpenSource#132)
1 parent ccb62f5 commit ad9916c

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/explorer/LeetCodeNode.ts

+9
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Licensed under the MIT license.
33

44
import { IProblem, ProblemState } from "../shared";
5+
import { Command } from "vscode";
56

67
export class LeetCodeNode {
78
constructor(private data: IProblem, private parentNodeName: string, private isProblemNode: boolean = true) { }
@@ -48,4 +49,12 @@ export class LeetCodeNode {
4849
public get parentName(): string {
4950
return this.parentNodeName;
5051
}
52+
53+
public get selectedCommand(): Command {
54+
return {
55+
title: 'Open Problem',
56+
command: 'leetcode.showProblem',
57+
arguments: [this]
58+
}
59+
}
5160
}

src/explorer/LeetCodeTreeDataProvider.ts

+1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ export class LeetCodeTreeDataProvider implements vscode.TreeDataProvider<LeetCod
5252
collapsibleState: element.isProblem ? vscode.TreeItemCollapsibleState.None : vscode.TreeItemCollapsibleState.Collapsed,
5353
contextValue: element.isProblem ? "problem" : element.id.toLowerCase(),
5454
iconPath: this.parseIconPathFromProblemState(element),
55+
command: element.isProblem ? element.selectedCommand : undefined
5556
};
5657
}
5758

0 commit comments

Comments
 (0)