Fix: Handle empty custom menu commands gracefully (Ctrl+Shift+M)#32
Merged
BernardXiong merged 3 commits intomainfrom Oct 24, 2025
Merged
Fix: Handle empty custom menu commands gracefully (Ctrl+Shift+M)#32BernardXiong merged 3 commits intomainfrom
BernardXiong merged 3 commits intomainfrom
Conversation
- 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>
src/extension.ts
Outdated
| const items = getMenuItems(); | ||
| if (!items || items.length === 0) { | ||
| // Show message and open settings when no menu items configured | ||
| vscode.window.showInformationMessage( |
Member
There was a problem hiding this comment.
@copilot 可以直接打开,而不是还需要点击打开设置才打开。可以是直接打开,然后简单给一份提示,然后这份提示过一段时间后自动消失。
Contributor
Author
There was a problem hiding this comment.
已修改。现在按 Ctrl+Shift+M 时,设置页面会直接打开,同时在状态栏显示一条提示消息(5秒后自动消失)。
更改内容:
- 移除了需要点击的信息对话框和按钮
- 直接调用
vscode.commands.executeCommand('workbench.action.openSettings', 'smart.menuCommands') - 使用
vscode.window.setStatusBarMessage()显示临时提示(5秒后自动消失)
提交: d103bd6
Copilot
AI
changed the title
[WIP] Fix error when custom menu does not exist
Fix: Handle empty custom menu commands gracefully (Ctrl+Shift+M)
Oct 24, 2025
- 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>
BernardXiong
approved these changes
Oct 24, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When users pressed
Ctrl+Shift+Mwithout configuring custom menu commands (smart.menuCommands), the extension threw an error:This occurred because the
extension.openMenucommand was only registered whenmenuItems.length > 0, but the keybindingCtrl+Shift+Mwas always active, creating a mismatch between the registered commands and keybindings.Solution
1. Always Register the Command
Modified
src/extension.tsto always register theextension.openMenucommand, regardless of whether custom menu items are configured:When menu commands are not configured, the settings page opens immediately and a non-intrusive status bar notification appears for 5 seconds before automatically dismissing.
2. Enhanced Configuration Schema
Improved
package.jsonconfiguration with user-friendly descriptions and examples in Chinese:smart.menuCommands:
scons -c,scons --dist, etc.)scopeandorderproperties for better organizationsmart.parallelBuidNumber:
minimum: 1validation to prevent invalid valuesBenefits
Testing
Fixes #31
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.