Fix: Handle empty custom menu commands gracefully (Ctrl+Shift+M) #32
+32
−14
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.