From 00dad4962a2b6da84c32127de34fc50241594e68 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 24 Oct 2025 16:13:00 +0000 Subject: [PATCH 1/3] Initial plan From ea202da39674dd9c77b3c9a323a70fce232f5c1b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 24 Oct 2025 16:18:35 +0000 Subject: [PATCH 2/3] Fix: Always register openMenu command and improve settings UI - Register extension.openMenu command regardless of menu items existence - Show helpful message and open settings when menu is empty - Improve package.json configuration with descriptions and examples - Add minimum value validation for parallelBuidNumber Co-authored-by: BernardXiong <1241087+BernardXiong@users.noreply.github.com> --- package.json | 15 ++++++++++++--- src/extension.ts | 37 ++++++++++++++++++++++++++----------- 2 files changed, 38 insertions(+), 14 deletions(-) diff --git a/package.json b/package.json index 91bcba0..099eb82 100644 --- a/package.json +++ b/package.json @@ -159,18 +159,27 @@ }, "configuration": { "type": "object", - "title": "Custom Commands(menu)", + "title": "RT-Thread Smart", "properties": { "smart.menuCommands": { "type": "array", "items": { "type": "string" }, - "default": [] + "default": [], + "description": "自定义构建菜单命令列表,使用 Ctrl+Shift+M 快捷键打开菜单。", + "markdownDescription": "自定义构建菜单命令列表,使用 `Ctrl+Shift+M` 快捷键打开菜单。\n\n**示例:**\n```json\n[\n \"scons -c\",\n \"scons --dist\",\n \"scons --target=mdk5\"\n]\n```", + "scope": "resource", + "order": 0 }, "smart.parallelBuidNumber": { "type": "number", - "default": 1 + "default": 1, + "minimum": 1, + "description": "并行编译使用的 CPU 核心数(默认为 1)。设置大于 1 的值可以加快编译速度。", + "markdownDescription": "并行编译使用的 CPU 核心数(默认为 1)。\n\n设置大于 1 的值可以加快编译速度,例如:\n- `1`: 单核编译\n- `4`: 使用 4 个核心并行编译\n- `8`: 使用 8 个核心并行编译", + "scope": "resource", + "order": 1 } } }, diff --git a/src/extension.ts b/src/extension.ts index f88a5ae..7fbe496 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -174,6 +174,32 @@ function setupStatusBarItems(context: vscode.ExtensionContext) { }); let menuItems = getMenuItems(); + + // Always register the command, regardless of menu items + let disposable = vscode.commands.registerCommand('extension.openMenu', () => { + const items = getMenuItems(); + if (!items || items.length === 0) { + // Show message and open settings when no menu items configured + vscode.window.showInformationMessage( + '自定义菜单命令未配置,请在设置中添加自定义命令。', + '打开设置' + ).then(selection => { + if (selection === '打开设置') { + vscode.commands.executeCommand('workbench.action.openSettings', 'smart.menuCommands'); + } + }); + } else { + vscode.window.showQuickPick(items).then(selectedItem => { + if (selectedItem) { + executeCommand(selectedItem); + } + }); + } + }); + + context.subscriptions.push(disposable); + + // Only show status bar item if menu items exist if (menuItems && menuItems.length > 0) { const statusItem = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Right, 100); statusItem.text = '$(menu) 自定义构建...'; @@ -182,17 +208,6 @@ function setupStatusBarItems(context: vscode.ExtensionContext) { statusItem.show(); context.subscriptions.push(statusItem); - - let disposable = vscode.commands.registerCommand('extension.openMenu', () => { - const items = getMenuItems(); - vscode.window.showQuickPick(items).then(selectedItem => { - if (selectedItem) { - executeCommand(selectedItem); - } - }); - }); - - context.subscriptions.push(disposable); } } From d103bd6a54ae5d0046ed46578e991d8033fbf802 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 24 Oct 2025 16:30:15 +0000 Subject: [PATCH 3/3] Improve UX: Directly open settings with auto-dismiss notification - Settings now open automatically without requiring button click - Status bar message shows temporary notification (5 seconds) - More streamlined user experience as requested in review Co-authored-by: BernardXiong <1241087+BernardXiong@users.noreply.github.com> --- src/extension.ts | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/extension.ts b/src/extension.ts index 7fbe496..e8236fb 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -179,15 +179,9 @@ function setupStatusBarItems(context: vscode.ExtensionContext) { let disposable = vscode.commands.registerCommand('extension.openMenu', () => { const items = getMenuItems(); if (!items || items.length === 0) { - // Show message and open settings when no menu items configured - vscode.window.showInformationMessage( - '自定义菜单命令未配置,请在设置中添加自定义命令。', - '打开设置' - ).then(selection => { - if (selection === '打开设置') { - vscode.commands.executeCommand('workbench.action.openSettings', 'smart.menuCommands'); - } - }); + // Directly open settings and show a temporary notification + vscode.commands.executeCommand('workbench.action.openSettings', 'smart.menuCommands'); + vscode.window.setStatusBarMessage('$(info) 自定义菜单命令未配置,请添加自定义命令', 5000); } else { vscode.window.showQuickPick(items).then(selectedItem => { if (selectedItem) {