Skip to content

Commit dbeddab

Browse files
committed
Add Click the tree explorer should open the topic (#132)
1 parent ccb62f5 commit dbeddab

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
@@ -1,6 +1,7 @@
11
// Copyright (c) jdneo. All rights reserved.
22
// Licensed under the MIT license.
33

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

67
export class LeetCodeNode {
@@ -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)