fix: Enable prompt-based slash commands in Edit mode while filtering out built-in legacy commands #7907
+26
−3
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 highlighting code and pressing
cmd+I
to start Edit mode, pressing/
only shows "Explore prompts" as if there are no prompts available. However, in Chat mode, pressing/
correctly shows all available prompts and slash commands.Solution
Fixed the slash command filtering logic in Edit mode to allow prompt-based commands while still filtering out inappropriate built-in legacy commands.
Changes:
ContinueInputBox.tsx
: Added whitelist of allowed slash command sources for Edit modesource
property in slash command datasource
property toComboBoxItem
interfaceAllowed sources in Edit mode:
yaml-prompt-block
- YAML prompt blocksmcp-prompt
- MCP server promptsprompt-file-v1
&prompt-file-v2
- Prompt filesinvokable-rule
- Invokable rulesFiltered out in Edit mode:
built-in-legacy
commands like/commit
,/share
, etc.Result
Edit mode now properly shows relevant prompts when pressing
/
instead of just "Explore prompts", making it consistent with Chat mode behavior for prompt-based slash commands.Testing
The filtering logic has been implemented with proper TypeScript types and follows the same pattern as context provider filtering. The whitelist approach ensures only appropriate command sources are shown in Edit mode.
Summary by cubic
Enabled prompt-based slash commands in Edit mode by whitelisting allowed sources and filtering out built-in legacy commands. Pressing / in Edit now shows relevant prompts, matching Chat mode.