@@ -1148,9 +1148,9 @@ def cmd_architect(self, args):
1148
1148
1149
1149
def cmd_context (self , args ):
1150
1150
"""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 )
1152
1152
1153
- def _generic_chat_command (self , args , edit_format ):
1153
+ def _generic_chat_command (self , args , edit_format , placeholder = None ):
1154
1154
if not args .strip ():
1155
1155
# Switch to the corresponding chat mode if no args provided
1156
1156
return self .cmd_chat_mode (edit_format )
@@ -1167,22 +1167,14 @@ def _generic_chat_command(self, args, edit_format):
1167
1167
user_msg = args
1168
1168
coder .run (user_msg )
1169
1169
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
+ )
1186
1178
1187
1179
def get_help_md (self ):
1188
1180
"Show help about all commands in markdown"
0 commit comments