Skip to content

Commit 05b48df

Browse files
committed
feat: 添加“关于”页面到命令树,注册相关命令
1 parent aac066b commit 05b48df

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

src/dock.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,16 @@ class CmdTreeDataProvider implements vscode.TreeDataProvider<vscode.TreeItem> {
3838
arguments: [],
3939
};
4040

41-
return [createProject, rtSetting];
41+
let about = new vscode.TreeItem("About", vscode.TreeItemCollapsibleState.None);
42+
about.iconPath = new vscode.ThemeIcon("info");
43+
about.label = "About";
44+
about.command = {
45+
command: "extension.showAbout",
46+
title: "show about page",
47+
arguments: [],
48+
}
49+
50+
return [createProject, rtSetting, about];
4251
}
4352

4453
if (!element) {

src/extension.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,6 @@ export async function activate(context: vscode.ExtensionContext) {
8585
initOnDidChangeListener(context);
8686

8787
// register commands
88-
vscode.commands.registerCommand('extension.showAbout', () => {
89-
openAboutWebview(context);
90-
});
9188
vscode.commands.registerCommand('extension.executeCommand', (arg1, arg2) => {
9289
if (arg1)
9390
{
@@ -110,11 +107,13 @@ export async function activate(context: vscode.ExtensionContext) {
110107
vscode.commands.registerCommand('extension.showSetting', () => {
111108
openSettingWebview(context);
112109
});
113-
114110
vscode.commands.registerCommand('extension.showCreateProject', () => {
115111
openCreateProjectWebview(context);
116112
});
117-
113+
vscode.commands.registerCommand('extension.showAbout', () => {
114+
openAboutWebview(context);
115+
});
116+
118117
if (isRTThreadWorksapce) {
119118
vscode.commands.registerCommand('extension.showWorkspaceSettings', () => {
120119
openWorkspaceProjectsWebview(context);

0 commit comments

Comments
 (0)