@@ -71,6 +71,8 @@ const PromptsView = ({ onDone }: PromptsViewProps) => {
7171 preferredLanguage,
7272 setPreferredLanguage,
7373 customModes,
74+ enableCustomModeCreation,
75+ setEnableCustomModeCreation,
7476 } = useExtensionState ( )
7577
7678 // Memoize modes to preserve array order
@@ -341,6 +343,17 @@ const PromptsView = ({ onDone }: PromptsViewProps) => {
341343 return ( ) => document . removeEventListener ( "click" , handleClickOutside )
342344 } , [ showConfigMenu ] )
343345
346+ // Add effect to sync enableCustomModeCreation with backend
347+ useEffect ( ( ) => {
348+ if ( enableCustomModeCreation !== undefined ) {
349+ // Send the value to the extension's global state
350+ vscode . postMessage ( {
351+ type : "enableCustomModeCreation" , // Using dedicated message type
352+ bool : enableCustomModeCreation ,
353+ } )
354+ }
355+ } , [ enableCustomModeCreation ] )
356+
344357 useEffect ( ( ) => {
345358 const handler = ( event : MessageEvent ) => {
346359 const message = event . data
@@ -541,7 +554,6 @@ const PromptsView = ({ onDone }: PromptsViewProps) => {
541554 in your workspace.
542555 </ div >
543556 </ div >
544-
545557 < div className = "mt-5" >
546558 < div onClick = { ( e ) => e . stopPropagation ( ) } className = "flex justify-between items-center mb-3" >
547559 < h3 className = "text-vscode-foreground m-0" > Modes</ h3 >
@@ -1010,6 +1022,35 @@ const PromptsView = ({ onDone }: PromptsViewProps) => {
10101022 </ div >
10111023 ) }
10121024 </ div >
1025+
1026+ { /*
1027+ NOTE: This setting is placed in PromptsView rather than SettingsView since it
1028+ directly affects the functionality related to modes and custom mode creation,
1029+ which are managed in this component. This is an intentional deviation from
1030+ the standard pattern described in cline_docs/settings.md.
1031+ */ }
1032+ < div className = "mb-4 mt-4" >
1033+ < VSCodeCheckbox
1034+ checked = { enableCustomModeCreation ?? true }
1035+ onChange = { ( e : any ) => {
1036+ // Just update the local state through React context
1037+ // The React context will update the global state
1038+ setEnableCustomModeCreation ( e . target . checked )
1039+ } } >
1040+ < span style = { { fontWeight : "500" } } > Enable Custom Mode Creation Through Prompts</ span >
1041+ </ VSCodeCheckbox >
1042+ < p
1043+ style = { {
1044+ fontSize : "12px" ,
1045+ marginTop : "5px" ,
1046+ color : "var(--vscode-descriptionForeground)" ,
1047+ } } >
1048+ When enabled, Roo allows you to create custom modes using prompts like ‘Make me a custom
1049+ mode that…’. Disabling this reduces your system prompt by about 700 tokens when this feature
1050+ isn’t needed. When disabled you can still manually create custom modes using the + button
1051+ above or by editing the related config JSON.
1052+ </ p >
1053+ </ div >
10131054 </ div >
10141055
10151056 < div
0 commit comments