From 8820f0ee0d94650d7cc18989d70ac79c4e942864 Mon Sep 17 00:00:00 2001 From: Continue Agent Date: Mon, 22 Sep 2025 21:29:54 +0000 Subject: [PATCH] Fix Edit mode slash command filtering to show prompts - Allow prompt-based slash commands in Edit mode instead of filtering all - Add whitelist for allowed sources: yaml-prompt-block, mcp-prompt, prompt-file-v1/v2, invokable-rule - Extend ComboBoxItem interface to include source property - Update selector to include source in slash command data Fixes issue where Edit mode only showed 'Explore prompts' when pressing '/' instead of showing actual prompts like Chat mode Generated with [Continue](https://continue.dev) Co-Authored-By: Continue --- .../components/mainInput/ContinueInputBox.tsx | 19 ++++++++++++++++++- gui/src/components/mainInput/types.d.ts | 1 + gui/src/redux/selectors/index.ts | 1 + 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/gui/src/components/mainInput/ContinueInputBox.tsx b/gui/src/components/mainInput/ContinueInputBox.tsx index 3b2ed52ea17..b26f6850d72 100644 --- a/gui/src/components/mainInput/ContinueInputBox.tsx +++ b/gui/src/components/mainInput/ContinueInputBox.tsx @@ -38,6 +38,15 @@ const EDIT_DISALLOWED_CONTEXT_PROVIDERS = [ "repo-map", ]; +// Slash command sources that should be allowed in edit mode +const EDIT_ALLOWED_SLASH_COMMAND_SOURCES: Set = new Set([ + "yaml-prompt-block", + "mcp-prompt", + "prompt-file-v1", + "prompt-file-v2", + "invokable-rule", +]); + function ContinueInputBox(props: ContinueInputBoxProps) { const isStreaming = useAppSelector((state) => state.session.isStreaming); const availableSlashCommands = useAppSelector( @@ -50,7 +59,15 @@ function ContinueInputBox(props: ContinueInputBoxProps) { const editModeState = useAppSelector((state) => state.editModeState); const filteredSlashCommands = useMemo(() => { - return isInEdit ? [] : availableSlashCommands; + if (!isInEdit) { + return availableSlashCommands; + } + + // In edit mode, only allow prompt-based slash commands + return availableSlashCommands.filter((command) => { + // Check if this command has a source property and if it's allowed in edit mode + return command.source && EDIT_ALLOWED_SLASH_COMMAND_SOURCES.has(command.source); + }); }, [isInEdit, availableSlashCommands]); const filteredContextProviders = useMemo(() => { diff --git a/gui/src/components/mainInput/types.d.ts b/gui/src/components/mainInput/types.d.ts index 70f5a5c61ce..52ccc5838a2 100644 --- a/gui/src/components/mainInput/types.d.ts +++ b/gui/src/components/mainInput/types.d.ts @@ -26,4 +26,5 @@ export interface ComboBoxItem { icon?: string; action?: () => void; subActions?: ComboBoxSubAction[]; + source?: string; } diff --git a/gui/src/redux/selectors/index.ts b/gui/src/redux/selectors/index.ts index 8247e56e028..99f6f659fbb 100644 --- a/gui/src/redux/selectors/index.ts +++ b/gui/src/redux/selectors/index.ts @@ -22,6 +22,7 @@ export const selectSlashCommandComboBoxInputs = createSelector( description: cmd.description, type: "slashCommand" as ComboBoxItemType, content: content, + source: cmd.source, } as ComboBoxItem; }) || [] );