diff --git a/.changeset/honest-queens-pump.md b/.changeset/honest-queens-pump.md new file mode 100644 index 0000000000..28e0e84c71 --- /dev/null +++ b/.changeset/honest-queens-pump.md @@ -0,0 +1,5 @@ +--- +"roo-cline": patch +--- + +Include custom modes in mode switching keyboard shortcut diff --git a/webview-ui/src/components/chat/ChatView.tsx b/webview-ui/src/components/chat/ChatView.tsx index bb23a0189c..fe0dc7e168 100644 --- a/webview-ui/src/components/chat/ChatView.tsx +++ b/webview-ui/src/components/chat/ChatView.tsx @@ -28,7 +28,7 @@ import TaskHeader from "./TaskHeader" import AutoApproveMenu from "./AutoApproveMenu" import { AudioType } from "../../../../src/shared/WebviewMessage" import { validateCommand } from "../../utils/command-validation" -import { modes } from "../../../../src/shared/modes" +import { getAllModes } from "../../../../src/shared/modes" interface ChatViewProps { isHidden: boolean @@ -60,6 +60,7 @@ const ChatView = ({ isHidden, showAnnouncement, hideAnnouncement, showHistoryVie setMode, autoApprovalEnabled, alwaysAllowModeSwitch, + customModes, } = useExtensionState() //const task = messages.length > 0 ? (messages[0].say === "task" ? messages[0] : undefined) : undefined) : undefined @@ -967,12 +968,13 @@ const ChatView = ({ isHidden, showAnnouncement, hideAnnouncement, showHistoryVie isWriteToolAction, ]) - // Add this new function to handle mode switching + // Function to handle mode switching const switchToNextMode = useCallback(() => { - const currentModeIndex = modes.findIndex((m) => m.slug === mode) - const nextModeIndex = (currentModeIndex + 1) % modes.length - setMode(modes[nextModeIndex].slug) - }, [mode, setMode]) + const allModes = getAllModes(customModes) + const currentModeIndex = allModes.findIndex((m) => m.slug === mode) + const nextModeIndex = (currentModeIndex + 1) % allModes.length + setMode(allModes[nextModeIndex].slug) + }, [mode, setMode, customModes]) // Add keyboard event handler const handleKeyDown = useCallback(