@@ -1148,9 +1148,9 @@ def cmd_architect(self, args):
11481148
11491149 def cmd_context (self , args ):
11501150 """Enter context mode to see surrounding code context. If no prompt provided, switches to context mode.""" # noqa
1151- return self ._generic_chat_command (args , "context" )
1151+ return self ._generic_chat_command (args , "context" , placeholder = args . strip () or None )
11521152
1153- def _generic_chat_command (self , args , edit_format ):
1153+ def _generic_chat_command (self , args , edit_format , placeholder = None ):
11541154 if not args .strip ():
11551155 # Switch to the corresponding chat mode if no args provided
11561156 return self .cmd_chat_mode (edit_format )
@@ -1167,22 +1167,14 @@ def _generic_chat_command(self, args, edit_format):
11671167 user_msg = args
11681168 coder .run (user_msg )
11691169
1170- # When using context command, set the placeholder to the args
1171- if edit_format == "context" and args .strip ():
1172- raise SwitchCoder (
1173- edit_format = self .coder .edit_format ,
1174- summarize_from_coder = False ,
1175- from_coder = coder ,
1176- show_announcements = False ,
1177- placeholder = args ,
1178- )
1179- else :
1180- raise SwitchCoder (
1181- edit_format = self .coder .edit_format ,
1182- summarize_from_coder = False ,
1183- from_coder = coder ,
1184- show_announcements = False ,
1185- )
1170+ # Use the provided placeholder if any
1171+ raise SwitchCoder (
1172+ edit_format = self .coder .edit_format ,
1173+ summarize_from_coder = False ,
1174+ from_coder = coder ,
1175+ show_announcements = False ,
1176+ placeholder = placeholder ,
1177+ )
11861178
11871179 def get_help_md (self ):
11881180 "Show help about all commands in markdown"
0 commit comments