@@ -28,7 +28,7 @@ import TaskHeader from "./TaskHeader"
2828import AutoApproveMenu from "./AutoApproveMenu"
2929import { AudioType } from "../../../../src/shared/WebviewMessage"
3030import { validateCommand } from "../../utils/command-validation"
31- import { modes } from "../../../../src/shared/modes"
31+ import { getAllModes } from "../../../../src/shared/modes"
3232
3333interface ChatViewProps {
3434 isHidden : boolean
@@ -60,6 +60,7 @@ const ChatView = ({ isHidden, showAnnouncement, hideAnnouncement, showHistoryVie
6060 setMode,
6161 autoApprovalEnabled,
6262 alwaysAllowModeSwitch,
63+ customModes,
6364 } = useExtensionState ( )
6465
6566 //const task = messages.length > 0 ? (messages[0].say === "task" ? messages[0] : undefined) : undefined) : undefined
@@ -967,12 +968,13 @@ const ChatView = ({ isHidden, showAnnouncement, hideAnnouncement, showHistoryVie
967968 isWriteToolAction ,
968969 ] )
969970
970- // Add this new function to handle mode switching
971+ // Function to handle mode switching
971972 const switchToNextMode = useCallback ( ( ) => {
972- const currentModeIndex = modes . findIndex ( ( m ) => m . slug === mode )
973- const nextModeIndex = ( currentModeIndex + 1 ) % modes . length
974- setMode ( modes [ nextModeIndex ] . slug )
975- } , [ mode , setMode ] )
973+ const allModes = getAllModes ( customModes )
974+ const currentModeIndex = allModes . findIndex ( ( m ) => m . slug === mode )
975+ const nextModeIndex = ( currentModeIndex + 1 ) % allModes . length
976+ setMode ( allModes [ nextModeIndex ] . slug )
977+ } , [ mode , setMode , customModes ] )
976978
977979 // Add keyboard event handler
978980 const handleKeyDown = useCallback (
0 commit comments